Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

impurge

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

impurge - npm Package Compare versions

Comparing version 0.0.61 to 0.0.62

18

impurge.js

@@ -1,4 +0,3 @@

var $ = require("cheerio"),
request = require("request")
var impurge = [];
var request = require("request")
var impurge = [];

@@ -17,11 +16,6 @@ module.exports = impurge;

impurge.get_text_imgur_links = function(text) {
var imgur_url_pattern = RegExp("http(s)?://((m)\.|(www)\.|((i)\.))?imgur.com/(a/)?[a-zA-Z0-9&]+((\.jpg)|(\.gif)|(\.png))?", "igm");
var matches = imgur_url_pattern.exec(text);
var urls = []
while ((matches = imgur_url_pattern.exec(text)) !== null) {
urls.push(matches[0]);
};
return urls;
console.log(text)
var imgur_url_pattern = RegExp("(http)(s)?://((m)\.|(www)\.|((i)\.))?imgur.com/(a/)?[a-zA-Z0-9&]+((\.jpg)|(\.gif)|(\.png))?", "igm");
var matches = text.match(imgur_url_pattern);
return matches;
}

@@ -28,0 +22,0 @@

@@ -9,3 +9,3 @@ {

},
"version": "0.0.61",
"version": "0.0.62",
"description": "takes any imgur url and returns an array of direct image files",

@@ -16,5 +16,6 @@ "engines": {

"dependencies": {
"cheerio": "*",
"mocha": "*",
"request": "~2.11.4",
"cheerio": "*"
"reddit-user-dump": "0.0.2",
"request": "~2.11.4"
},

@@ -21,0 +22,0 @@ "devDependencies": {

@@ -51,9 +51,26 @@ var request = require('request');

//this is a test for text it should return 5 links
// var testTextAlbum = 'http://imgur.com/a/o7AVs is a album_url with id: [ o7AVs ] and url undefined ';
// var testTextImage = 'http://i.imgur.com/4aCgHc7.jpg is a image_url with id: null and url http://i.imgur.com/4aCgHc7.jpg ';
// var testTextHash = 'http://i.imgur.com/oM1mFEd.jpg is a hash_url with id: [ oM1mFEd] and url undefined ';
// var testTextAlbum2 = 'http://imgur.com/a/h4gt1 is a album_url with id: [ h4gt1 ] and url undefined';
// var testText = testTextAlbum + testTextImage + testTextHash + testTextAlbum2;
// console.log(testText);
// var comment_links = impurge.get_text_imgur_links(testText);
var testUserObj = {};
var buffer = [];
var scrape = require('reddit-user-dump'); //this sets up the user objects for parsing
scrape('test_predditor')
.on('user', function(userObj) {
testUserObj = userObj;
}).on('data', function(post) {
buffer.push(post)
})
.on('submission', function(submission) {
testSubmission = submission.data;
})
.on('comment', function(comment) {
parseComment(comment.data)
})
.on('end', function() {
})
function parseComment(comment) {
//console.log(comment.body_html)
console.log(impurge.get_text_imgur_links(comment.body + ' ' + comment.body));
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc