download - seedlinux - Torrent indexing tool opensource torrents with share ratio's etc.
(HTM) git clone git://jay.scot/seedlinux
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
download (2911B)
---
1 #!/usr/bin/env node
2 'use strict';
3
4 const request = require('request');
5 const cheerio = require('cheerio');
6 const download = require('download-to-file')
7 const S = require('string');
8
9 const torrent_data = "./data/torrents/"
10
11 console.log('Downloading torrents');
12
13 function distrowatch_torrents() {
14 const baseurl = "http://distrowatch.com/"
15
16 request(baseurl + 'dwres.php?resource=bittorrent', function (error, response, html) {
17 if (!error && response.statusCode == 200) {
18 var $ = cheerio.load(html);
19 $('td.torrent').each(function(i, element){
20 var href = $('a', this).attr('href');
21
22 if (typeof href !== 'undefined' && href !== null){
23 let torrent_name = href.split('dwres/torrents/');
24
25 download(baseurl + href, torrent_data + torrent_name[1], function(err){
26 if (err) throw err
27 console.log("Downloaded - " + torrent_name[1])
28 })
29 }
30 });
31 }
32 });
33 }
34
35 function fedora_torrents() {
36 const baseurl = "https://torrent.fedoraproject.org/"
37
38 request(baseurl, function (error, response, html) {
39 if (!error && response.statusCode == 200) {
40 var $ = cheerio.load(html);
41 $('td').each(function(i, element){
42 var href = $('a', this).attr('href');
43
44 if (typeof href !== 'undefined' && href !== null){
45 let torrent_name = href.split('/torrents/');
46
47 download(href, torrent_data + torrent_name[1], function(err){
48 if (err) throw err
49 console.log("Downloaded - " + torrent_name[1])
50 })
51 }
52 });
53 }
54 });
55 }
56
57 function antergos_torrents() {
58 const baseurl = "http://mirrors.antergos.com/iso/release/"
59 const mirrorurl = "http://mirrorservice.org/sites/repo.antergos.com/iso/release/"
60
61 console.log('Downloading torrents from Antergos');
62 request(baseurl, function (error, response, html) {
63 if (!error && response.statusCode == 200) {
64 var $ = cheerio.load(html);
65 $('td').each(function(i, element){
66 var href = $('a', this).attr('href');
67
68 if (typeof href !== 'undefined' && href !== null){
69 if ( S(href).endsWith('.torrent') ) {
70 download(mirrorurl + href, torrent_data + href, function(err){
71 if (err) throw err
72 console.log("Downloaded - " + href)
73 })
74 }
75 }
76 // if (typeof href !== 'undefined' && href !== null){
77 // let torrent_name = href.split('/torrents/');
78
79 // download(href, torrent_data + torrent_name[1], function(err){
80 // if (err) throw err
81 // console.log("Downloaded - " + torrent_name[1])
82 // })
83 // }
84 });
85 }
86 });
87 }
88
89
90 // using the following list for torrent sources https://www.reddit.com/r/linux/comments/56no6f/legal_torrents_only_what_linux_or_other/
91 //distrowatch_torrents();
92 //fedora_torrents();
93 antergos_torrents();