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

4chan

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

4chan - npm Package Compare versions

Comparing version 0.0.10 to 0.1.0

71

4chan.js

@@ -144,5 +144,5 @@ var optimist = require('optimist');

var ff = _.map(idx, function(v, pageUrl) {
var ff = _.map(threads, function(v, threadUrl) {
return _x(null, false, function(cb) {
getPage(pageUrl, threads, cb);
getThread(threadUrl, cb);
});

@@ -152,17 +152,3 @@ });

async.parallel(ff, _x(tcb, true, function(err) {
var f2 = _.map(threads, function(v, threadUrl) {
return _x(null, false, function(cb) {
getThread(threadUrl, cb);
});
});
// be kind to the server, work serially
// (there's a lot of threads in a forum)
async.series(f2, _x(tcb, true, function(err) {
tcb(null, 'Forum snapshot downloaded, exit.');
}));
tcb(null, 'Forum snapshot downloaded, exit.');
}));

@@ -291,5 +277,4 @@ }));

request(url, _x(cb, true, function(err, res, body) {
var idx = extractPageUrls(body);
extractThreadUrls(body, threads);
request(ua(url), _x(cb, true, function(err, res, body) {
var idx = extractPageUrls(body, threads);
cb(null, idx);

@@ -299,27 +284,13 @@ }));

function getPage(url, threads, cb) {
request({ url: url }, _x(cb, true, function(err, res, body) {
extractThreadUrls(body, threads);
cb(null);
}));
}
function extractPageUrls(body, links) {
function extractThreadUrls(body, threads) {
var base = url.replace(/catalog/, 'thread');
var $ = cheerio.load(body);
$("a.button:contains('View Thread')").each(function(i, e) {
var a = url + $(this).attr('href');
threads[a] = true;
var json = /var catalog = (.+);var style_group/.exec(body)[1]
var doc = JSON.parse(json);
Object.keys(doc.threads).forEach((id) => {
links[base + '/' + id] = true;
});
}
function extractPageUrls(body) {
var $ = cheerio.load(body);
var links = {};
$('div.desktop div.pages a').each(function() {
var lnk = $(this).attr('href');
if(lnk !== './catalog')
links[url + lnk] = true;
});
return links;

@@ -330,5 +301,14 @@ }

function ua(url) {
return {
url: url,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
}
}
}
function getPics(url, thread, cb) {
request(url, _x(cb, true, function(err, res, body) {
request(ua(url), _x(cb, true, function(err, res, body) {

@@ -487,6 +467,5 @@ var ret = {

var opts = {
url: entry.url,
encoding: null
};
var opts = ua(entry.url);
opts.encoding = null;
opts.referer = 'https://boards.4chan.org/';

@@ -493,0 +472,0 @@ request(opts, _x(cb, true, function(err, res, body) {

{
"author": "Juraj Vitko (ypocat.com)",
"author": "youurayy",
"name": "4chan",
"description": "4chan picture downloader",
"keywords": [ "4chan", "picture", "downloader", "utility", "command line" ],
"version": "0.0.10",
"homepage": "http://github.com/ypocat/4chan",
"version": "0.1.0",
"repository": {
"type": "git",
"url": "git://github.com/ypocat/4chan.git"
"url": "git://github.com/youurayy/4chan.git"
},

@@ -19,3 +18,3 @@ "main": "4chan.js",

"engines": {
"node": ">= 0.6.0"
"node": ">= 10.0.0"
},

@@ -34,5 +33,3 @@ "dependencies": {

},
"licenses": [
{ "type" : "MIT", "url" : "https://raw.github.com/ypocat/4chan/master/LICENSE" }
]
"license": "MIT"
}

@@ -6,7 +6,7 @@ # 4chan picture downloader

Install Node.js if you don't have it yet. Then from the command line:
[sudo] npm install 4chan -g
Then proceed as follows:
mkdir directory

@@ -19,19 +19,1 @@ cd directory

Call the program with the `--help` option to see more options, like filtering based on image dimensions, gif/non-gif format, and categorization of images into landscape and portrait subdirectories for easier mobile viewing.
## Warning
4chan is an anonymous board and from time to time, on some of its forums (e.g. `/b/`), users upload illegal content, downloading of which may implicate you in a criminal investigation. Moderators of 4chan are promptly deleting such content from the forum, but when you download images in bulk, it may happen that this illegal content ends up on your harddrive.
When the 4chan downloader tool, while checking for thread updates, registers that an image was deleted from the thread, it will attempt to delete it from your harddrive. This will of course not happen if you quit the tool prematurely using Ctrl+C. This feature is also not active in the "forum" mode.
On the unsafe forums, the safest way is to inspect the thread before you run the downloading tool, and only running the tool with the one-shot switch (`-s`).
## License
(The MIT License)
Copyright (c) 2012 Juraj Vitko (http://ypocat.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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