scantradtk
Tools to download some resources from the web using a well known pattern For exemple, if you need to download a list of jpeg file that share the same url and are identified with an index:
http://mywebsite/requestPhoto/01.jpg, http://mywebsite/requestPhoto/02.jpg]
The module use two majors concept
- scheme: used to define the url of resource url construction
- target: used to define the final destination of this archive
Scheme is a json object that define some information parameters (optional or mandatory):
- url: a string representing the resource url, it uses placeholder to refer variable data
- extension: file extension, for example jpg for jpeg image file
- parameters: a collection of parameters used on placeholder, formating rules can be defined here
- counters: an arborescence of parameter that behave has iterators to generate the list of resource's url
Installation
$ npm install --save scantradtk
Usage
To download a chapter use the following
var scantradtk = ; // Add a scheme to download image from lel-scn.covar lelScheme = extension: 'jpg' pattern: url: 'http://lel-scan.co/mangas/${title}/${chapter}/${page}.${extension}?v=f' target: 'C${chapter}-${page}.${extension}' parameters : title : description: 'manga title' counters: 'chapter': url: 'none' target: 'fixed3' 'page' : url: 'fixed2' target: 'fixed3' ; scantradtk; // Add a target var lelTarget = type: 'zip' extension: 'cbz' ; scantradtk; // Donwload data using a specific scheme and target var data = title: 'gantz' counters: type: 'value' value: 301 type: 'interval' min:0 max:80 ;scantradtk;
License
MIT © Enoch Root