Comparing version 0.0.4 to 0.0.5
(function() { | ||
var $, bitrates, ent, f, formats, getTorrents, markOld, medias, parseArtist, parseDate, parseRelease, parseTorrentInfo, parseTorrents, request, torrentRegex, url; | ||
url = require('url'); | ||
request = require('request'); | ||
$ = require('jq').jQuery; | ||
$ = require('jquery'); | ||
ent = require('ent'); | ||
f = require('f'); | ||
getTorrents = function(options, callback) { | ||
var query, _ref; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
if (options == null) options = {}; | ||
query = options.query ? '?' + options.query : ''; | ||
options.uri = 'http://jpopsuki.eu/torrents.php' + query; | ||
if ((_ref = options.headers) == null) { | ||
options.headers = {}; | ||
} | ||
if ((_ref = options.headers) == null) options.headers = {}; | ||
options.headers.Cookie = options.cookie; | ||
return request(options, function(err, res, body) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (err) return callback(err); | ||
if (res.statusCode !== 200) { | ||
@@ -29,17 +29,12 @@ return callback(new Error('Response Error: ' + res.statusCode)); | ||
}; | ||
markOld = function(options, callback) { | ||
var _ref; | ||
if (options == null) { | ||
options = {}; | ||
} | ||
if (options == null) options = {}; | ||
options.uri = 'http://jpopsuki.eu/torrents.php?action=markold'; | ||
if ((_ref = options.headers) == null) { | ||
options.headers = {}; | ||
} | ||
if ((_ref = options.headers) == null) options.headers = {}; | ||
options.headers.Cookie = options.cookie; | ||
return request(options, function(err, res, body) { | ||
var table; | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (err) return callback(err); | ||
if (res.statusCode !== 200) { | ||
@@ -49,14 +44,11 @@ return callback(new Error('Response Error: ' + res.statusCode)); | ||
table = $('table#torrent_table', body); | ||
if (table.length === 0) { | ||
return callback(new Error('Unable to log in!')); | ||
} | ||
if (table.length === 0) return callback(new Error('Unable to log in!')); | ||
return callback(null); | ||
}); | ||
}; | ||
parseTorrents = function(body, callback) { | ||
var last, table, torrents; | ||
table = $('table#torrent_table', body); | ||
if (table.length === 0) { | ||
return callback(new Error('Unable to log in!')); | ||
} | ||
if (table.length === 0) return callback(new Error('Unable to log in!')); | ||
last = null; | ||
@@ -103,8 +95,7 @@ torrents = []; | ||
}; | ||
parseArtist = function(a) { | ||
var parsedHref, rs; | ||
parsedHref = url.parse(ent.decode(a.attr('href')), true); | ||
if (parsedHref.pathname !== 'artist.php') { | ||
return null; | ||
} | ||
if (parsedHref.pathname !== 'artist.php') return null; | ||
rs = /^(.+)?( \(View Artist\))|(View Artist)$/.exec(a.attr('title')); | ||
@@ -117,2 +108,3 @@ return { | ||
}; | ||
parseRelease = function(id, a, tds, single) { | ||
@@ -158,2 +150,3 @@ var comments, data, date, orgtitle, regex, rs, str, tags, td3split, title; | ||
}; | ||
parseDate = function(title, date) { | ||
@@ -165,6 +158,11 @@ var regex, rs; | ||
}; | ||
formats = ['MP3', 'FLAC', 'TAK', 'TTA', 'ALAC', 'Ogg Orbis', 'APE', 'AAC', 'WMA', 'AC3', 'WavPack', 'DTS', 'IMG', 'ISO', 'VOB', 'MPEG', 'MPEG2', 'AVI', 'MKV', 'WMV', 'MP4', 'h264', 'Ogg', 'WAV'].join('|'); | ||
bitrates = ['192', 'V2 \\(VBR\\)', 'V1 \\(VBR\\)', '256', 'V0 \\(VBR\\)', '320', 'Lossless', 'Variable', 'Other'].join('|'); | ||
medias = ['CD', 'DVD', 'Blu-Ray', 'VHS', 'VCD', 'TV', 'HDTV', 'Radio', 'Vinyl', 'WEB'].join('|'); | ||
torrentRegex = new RegExp('(' + formats + ')( \/ (' + bitrates + '))?( \/ (' + medias + '))?( \/ (.+))?( \/ Freeleech!)?'); | ||
parseTorrentInfo = function(id, str, tds, single) { | ||
@@ -196,2 +194,3 @@ var filetype, freeleech, n, quality, reissue, rs, source; | ||
}; | ||
module.exports = { | ||
@@ -220,2 +219,3 @@ getTorrents: getTorrents, | ||
}; | ||
}).call(this); |
{ | ||
"name": "jps", | ||
"description": "A scraper for the jpopsuki torrent tracker", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"repository": { | ||
@@ -11,2 +11,5 @@ "type": "git", | ||
"main": "./lib/scraper.js", | ||
"scripts": { | ||
"test": "vows test/test.js --spec" | ||
}, | ||
"engines": { | ||
@@ -16,4 +19,4 @@ "node": "*" | ||
"dependencies": { | ||
"request": ">=2.1.1", | ||
"jq": ">=1.2.2", | ||
"request": "=2.1.1", | ||
"jquery": ">=1.6.0", | ||
"ent": ">=0.0.4", | ||
@@ -20,0 +23,0 @@ "f": ">=0.0.1" |
@@ -1,7 +0,1 @@ | ||
Install | ||
------------ | ||
npm install jps | ||
Usage | ||
@@ -87,1 +81,16 @@ ------------------ | ||
Returns the link to a torrent's download. Excluding the `authkey` and `torrent_pass` fields in the url. | ||
Install | ||
------------ | ||
npm install jps | ||
Tests | ||
--------- | ||
Tests are written with [vows](http://vowsjs.org/) | ||
```bash | ||
npm test | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
19686
96
0
238
+ Addedjquery@>=1.6.0
+ Addedjquery@3.7.1(transitive)
- Removedjq@>=1.2.2
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbindings@1.5.0(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcontextify@0.1.15(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removedcssom@0.2.5(transitive)
- Removedcssstyle@4.1.0(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhtmlparser@1.7.7(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjq@1.7.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjsdom@0.2.19(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednan@2.22.0(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedrrweb-cssom@0.7.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedxmlhttprequest@1.3.0(transitive)
Updatedrequest@=2.1.1