tors 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4123d0ae088d788aae134a9e2ab5bfb5138a61ec
4
- data.tar.gz: 182d86c5d7633c0a1e2a8cd2aeea3193fb89160e
3
+ metadata.gz: 1ee398e99916449521153f862a0c18bb7534e7cc
4
+ data.tar.gz: 34f775df3c49296be598fe4d541c5b20ce27fef1
5
5
  SHA512:
6
- metadata.gz: bb9a2272db7c209518fc1cfc3fc102a10a9800596455dbd2b11697dc4cc09be990550f06ec1b4b06218fb37eb5f6872c6d398d28ac6f5c6971a52f2051f392ad
7
- data.tar.gz: 55b54cfcc54c3e98730c782cf7cf9f77d5dcce590950ed5709bc0a3dcc08b6676e45759b9c10ea4dbb5f7b80707c47ae9b95e8510496fd2bcfcd4ba6f93b9cc3
6
+ metadata.gz: 9ffa6277f1db5d387ce401abb32a4f66466f0a32cac5e62d3269558d878385fa3933dfba00f15a08fd2d301c9dc5ef14912c9a2a9a82b37ab661333298f8f4d5
7
+ data.tar.gz: 52caa081807d7a89ec6ea03a16b775db271fcb57cddc3d93cb1f44611ab3545ac6e5a8b1adbf5486c00b0a3a66c2f6a154e29fa6bd0327ceb5cdcbf21e22a7f7
data/README.md CHANGED
@@ -43,16 +43,16 @@ Because katcr fastest provider for scrabing currently.
43
43
 
44
44
  Yep, there is a few provider option.
45
45
 
46
- | Provider | Status |
47
- |:------------------|:------:|
48
- | katcr | ✅ |
49
- | rarbg | ✅ |
50
- | thepiratebay | ✅ |
51
- | extratorrent | ✅ |
52
- | 1337x | ✅ |
53
- | zooqle | ☑️ |
54
- | torrentfunk | ☑️ |
55
- | limetorrents | ☑️ |
46
+ | Provider | Status | Problems |
47
+ |:------------------|:------:|:---------|
48
+ | katcr | ✅ | - |
49
+ | rarbg | ✅ | Slow Connection, Threat defensing |
50
+ | thepiratebay | ✅ | Only Magnet |
51
+ | extratorrent | ✅ | Slow Connection |
52
+ | 1337x | ✅ | Connection N+1 |
53
+ | zooqle | | Skipping some torrents |
54
+ | torrentfunk | ☑️ | 🙈 |
55
+ | limetorrents | ☑️ | 🙈 |
56
56
 
57
57
  Use `-p PROVIDER` flag for scrape another providers.
58
58
 
@@ -76,9 +76,11 @@ And you can list all active providers and usage instructions with `-h` or `--hel
76
76
  -s, --search=s Search term [SEARCH]
77
77
  -d, --directory=d Destination path for download torrent [DIRECTORY]
78
78
  -p, --provider=p Provider name [PROVIDER]
79
+ -l, --list-providers List providers
79
80
  -a, --auto-download Auto download best choice
80
81
 
81
82
 
83
+
82
84
  [![See it in action](https://asciinema.org/a/No1Zdfk3gYoCYdGb2XUdFaUyS.png)](https://asciinema.org/a/No1Zdfk3gYoCYdGb2XUdFaUyS)
83
85
 
84
86
  ## Development
data/lib/tors.rb CHANGED
@@ -6,7 +6,7 @@ require 'optparse'
6
6
  module TorS
7
7
  options = {}
8
8
  OptionParser.new do |opts|
9
- opts.on('-h', '--help', 'Show usage instructions') do |s|
9
+ opts.on('-h', '--help', 'Show usage instructions') do |h|
10
10
  puts opts
11
11
  abort
12
12
  end
@@ -19,6 +19,12 @@ module TorS
19
19
  opts.on('-p=p', '--provider=p', 'Provider name [PROVIDER]') do |p|
20
20
  options[:provider] = p
21
21
  end
22
+ opts.on('-l', '--list-providers', 'List providers') do |l|
23
+ Dir[File.expand_path('providers/*.yml')].each do |f|
24
+ puts '- ' + File.basename(f).split('.').first
25
+ end
26
+ abort
27
+ end
22
28
  opts.on('-a', '--auto-download', 'Auto download best choice') do
23
29
  options[:auto] = true
24
30
  end
data/lib/tors/search.rb CHANGED
@@ -42,14 +42,20 @@ module TorS
42
42
 
43
43
  puts 'Scrabing...'
44
44
 
45
- @page.css(@provider['scrape']['selector']).each_with_index do |row, key|
45
+ key = 0
46
+ @page.css(@provider['scrape']['selector']).each do |row|
46
47
  hash = {
47
48
  key: key + 1,
48
49
  name: row.search(@provider['scrape']['data']['name']).text,
49
50
  url: ''
50
51
  }
51
52
  if @provider['scrape']['data']['download'].is_a?(String)
52
- hash[:url] = @provider['download_prefix'] + row.search(@provider['scrape']['data']['download']).first['href']
53
+ link = row.search(@provider['scrape']['data']['download'])
54
+ if !link.empty?
55
+ hash[:url] = @provider['download_prefix'] + link.first['href']
56
+ else
57
+ next
58
+ end
53
59
  else
54
60
  @subpage = Nokogiri::HTML(open(@provider['download_prefix'] + row.css(@provider['scrape']['data']['download']['url']).first['href']))
55
61
 
@@ -61,11 +67,13 @@ module TorS
61
67
  @rows << [
62
68
  (key + 1).to_s,
63
69
  !@provider['scrape']['data']['category'].empty? ? row.css(@provider['scrape']['data']['category']).text.tr("\n", ' ').squeeze(' ').strip : '',
64
- !@provider['scrape']['data']['name'].empty? ? row.css(@provider['scrape']['data']['name']).text.strip : '',
70
+ !@provider['scrape']['data']['name'].empty? ? row.css(@provider['scrape']['data']['name']).text.strip[0..60] + '[...]' : '',
65
71
  !@provider['scrape']['data']['size'].empty? ? row.css(@provider['scrape']['data']['size']).text.strip : '',
66
72
  !@provider['scrape']['data']['seed'].empty? ? row.css(@provider['scrape']['data']['seed']).text.strip.green : '',
67
73
  !@provider['scrape']['data']['leech'].empty? ? row.css(@provider['scrape']['data']['leech']).text.strip.red : ''
68
74
  ]
75
+
76
+ key += 1
69
77
  end
70
78
 
71
79
  results
@@ -112,6 +120,7 @@ module TorS
112
120
  puts '😵 There is an error! ' + e.message
113
121
  ensure
114
122
  puts '🥂 Downloaded!'
123
+ system 'open', target_file if RUBY_PLATFORM =~ /darwin/
115
124
  end
116
125
  end
117
126
  end
data/lib/tors/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TorS
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
@@ -0,0 +1,12 @@
1
+ name: 'zooqle'
2
+ url: "https://zooqle.com/search?q=%{query}&s=ns&v=t&sd=d"
3
+ download_prefix: "https://zooqle.com/"
4
+ scrape:
5
+ selector: 'table.table-torrents > tr'
6
+ data:
7
+ name: 'td:nth-child(2) > a'
8
+ category: ''
9
+ download: 'td:nth-child(3) ul li:nth-child(3) a'
10
+ size: 'div.progress-bar.prog-blue'
11
+ seed: 'div.progress-bar.prog-green'
12
+ leech: 'div.progress-bar.prog-yellow'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Murat Bastas
@@ -142,6 +142,7 @@ files:
142
142
  - providers/katcr.yml
143
143
  - providers/rarbg.yml
144
144
  - providers/thepiratebay.yml
145
+ - providers/zooqle.yml
145
146
  - tors.gemspec
146
147
  homepage: https://github.com/muratbsts/tors
147
148
  licenses: