From 58dd7265745652d58b0d6459346752ad031ce663 Mon Sep 17 00:00:00 2001 From: Murat Bastas Date: Thu, 31 Aug 2017 20:10:34 +0300 Subject: [PATCH] =?UTF-8?q?=E2=AD=90=EF=B8=8F=20New=20provider=20zooqle,?= =?UTF-8?q?=20Problems=20column=20for=20providers,=20List=20providers=20op?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 22 ++++++++++++---------- lib/tors/search.rb | 14 +++++++++++--- lib/tors/version.rb | 2 +- providers/zooqle.yml | 12 ++++++++++++ 4 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 providers/zooqle.yml diff --git a/README.md b/README.md index 6529b29..927d854 100644 --- a/README.md +++ b/README.md @@ -43,16 +43,16 @@ Because katcr fastest provider for scrabing currently. Yep, there is a few provider option. -| Provider | Status | -|:------------------|:------:| -| katcr | ✅ | -| rarbg | ✅ | -| thepiratebay | ✅ | -| extratorrent | ✅ | -| 1337x | ✅ | -| zooqle | ☑️ | -| torrentfunk | ☑️ | -| limetorrents | ☑️ | +| Provider | Status | Problems | +|:------------------|:------:|:---------| +| katcr | ✅ | - | +| rarbg | ✅ | Slow Connection, Threat defensing | +| thepiratebay | ✅ | Only Magnet | +| extratorrent | ✅ | Slow Connection | +| 1337x | ✅ | Connection N+1 | +| zooqle | ✅ | Skipping some torrents | +| torrentfunk | ☑️ | 🙈 | +| limetorrents | ☑️ | 🙈 | Use `-p PROVIDER` flag for scrape another providers. @@ -76,9 +76,11 @@ And you can list all active providers and usage instructions with `-h` or `--hel -s, --search=s Search term [SEARCH] -d, --directory=d Destination path for download torrent [DIRECTORY] -p, --provider=p Provider name [PROVIDER] + -l, --list-providers List providers -a, --auto-download Auto download best choice + [![See it in action](https://asciinema.org/a/No1Zdfk3gYoCYdGb2XUdFaUyS.png)](https://asciinema.org/a/No1Zdfk3gYoCYdGb2XUdFaUyS) ## Development diff --git a/lib/tors/search.rb b/lib/tors/search.rb index d2d8943..8861300 100644 --- a/lib/tors/search.rb +++ b/lib/tors/search.rb @@ -42,14 +42,20 @@ def scrape puts 'Scrabing...' - @page.css(@provider['scrape']['selector']).each_with_index do |row, key| + key = 0 + @page.css(@provider['scrape']['selector']).each do |row| hash = { key: key + 1, name: row.search(@provider['scrape']['data']['name']).text, url: '' } if @provider['scrape']['data']['download'].is_a?(String) - hash[:url] = @provider['download_prefix'] + row.search(@provider['scrape']['data']['download']).first['href'] + link = row.search(@provider['scrape']['data']['download']) + if !link.empty? + hash[:url] = @provider['download_prefix'] + link.first['href'] + else + next + end else @subpage = Nokogiri::HTML(open(@provider['download_prefix'] + row.css(@provider['scrape']['data']['download']['url']).first['href'])) @@ -61,11 +67,13 @@ def scrape @rows << [ (key + 1).to_s, !@provider['scrape']['data']['category'].empty? ? row.css(@provider['scrape']['data']['category']).text.tr("\n", ' ').squeeze(' ').strip : '', - !@provider['scrape']['data']['name'].empty? ? row.css(@provider['scrape']['data']['name']).text.strip : '', + !@provider['scrape']['data']['name'].empty? ? row.css(@provider['scrape']['data']['name']).text.strip[0..60] + '[...]' : '', !@provider['scrape']['data']['size'].empty? ? row.css(@provider['scrape']['data']['size']).text.strip : '', !@provider['scrape']['data']['seed'].empty? ? row.css(@provider['scrape']['data']['seed']).text.strip.green : '', !@provider['scrape']['data']['leech'].empty? ? row.css(@provider['scrape']['data']['leech']).text.strip.red : '' ] + + key += 1 end results diff --git a/lib/tors/version.rb b/lib/tors/version.rb index 019b9eb..935d4f4 100644 --- a/lib/tors/version.rb +++ b/lib/tors/version.rb @@ -1,3 +1,3 @@ module TorS - VERSION = '0.2.2'.freeze + VERSION = '0.3.0'.freeze end diff --git a/providers/zooqle.yml b/providers/zooqle.yml new file mode 100644 index 0000000..8c06605 --- /dev/null +++ b/providers/zooqle.yml @@ -0,0 +1,12 @@ +name: 'zooqle' +url: "https://zooqle.com/search?q=%{query}&s=ns&v=t&sd=d" +download_prefix: "https://zooqle.com/" +scrape: + selector: 'table.table-torrents > tr' + data: + name: 'td:nth-child(2) > a' + category: '' + download: 'td:nth-child(3) ul li:nth-child(3) a' + size: 'div.progress-bar.prog-blue' + seed: 'div.progress-bar.prog-green' + leech: 'div.progress-bar.prog-yellow' \ No newline at end of file