Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
attachment-detection
Advanced tools
Usage:
var AttachmentDetector = require('attachment-detection');
var detector = new AttachmentDetector();
detector.use(AttachmentDetector.YouTube);
detector.use(AttachmentDetector.Image);
detector.use(AttachmentDetector.Link);
Detectors are tried in the way they are used, so be sure to use the most specific ones first. Link catches all.
Each new attachment detector has its own set of handlers. When you have added some handlers to the detector, you can then pass the detector an array of string, containing one link each:
detector.detect([
'http://www.youtube.com/watch?v=R_WHWCy48c0',
'http://youtu.be/R_WHWCy48c0',
'www.google.dk',
'www.test.com/image.jpg'
], function(attachments) {
}))
Responds with the following:
[{
"link": "http://youtu.be/R_WHWCy48c0",
"id": "R_WHWCy48c0",
"type": "youtube",
"url": "http://youtu.be/R_WHWCy48c0",
"title": "GirlsOnDrugs - Pass the ∆",
"description": "Location: UK\nReleased: May 2012\nGirlsOnDrugs\n(Alt -J - Breezeblocks Remix)\nhttp://soundcloud.com/girlsondrugs\nhttp://dl.dropbox.com/u/57622845/06%20Pass%20the.mp3",
"images": [
{
"url": "http://i.ytimg.com/vi/R_WHWCy48c0/0.jpg",
"height": 360,
"width": 480
},
{
"url": "http://i.ytimg.com/vi/R_WHWCy48c0/1.jpg",
"height": 90,
"width": 120
},
{
"url": "http://i.ytimg.com/vi/R_WHWCy48c0/2.jpg",
"height": 90,
"width": 120
},
{
"url": "http://i.ytimg.com/vi/R_WHWCy48c0/3.jpg",
"height": 90,
"width": 120
}
]
}, {
"link": "www.google.com",
"type": "link",
"url": "http://www.google.com",
"title": "Google",
"description": null
}, {
"link": "www.test.com/image.jpg",
"type": "image",
"url": "http://www.test.com/image.jpg",
}]
For performance purposes we choose to utilize API's where available. That means we get YouTube video titles and thumbnails from the Google Data API instead of parsing the HTML.
FAQs
Attactment detection for youtube, images and links
The npm package attachment-detection receives a total of 0 weekly downloads. As such, attachment-detection popularity was classified as not popular.
We found that attachment-detection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.