download_tv 2.9.1 → 2.9.2
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/download_tv.gemspec +2 -2
- data/lib/download_tv/configuration.rb +1 -1
- data/lib/download_tv/grabbers/torrentgalaxy.rb +1 -1
- data/lib/download_tv/grabbers/tpb.rb +1 -1
- data/lib/download_tv/torrent.rb +1 -1
- data/lib/download_tv/version.rb +1 -1
- data/spec/download_tv/torrent_spec.rb +22 -27
- metadata +15 -16
- data/lib/download_tv/grabbers/torrentz.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f0cca5d2bc54450e34f7ab30a9cb79abe1019929e19ac3ce7465ad7c2248f7d
|
4
|
+
data.tar.gz: eba05f15716ea83c3c1c5f7671054018c4e4b693e9fcf4f58e8e516d9591d51b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b40a876f14b73d29e5d94d50efd4c634fa39fb2cf1eb6fd684496f1fb3b57f29ecbaeda0e19e309a3346dbd44202c576a5963b698af09f9313b7805208fc926c
|
7
|
+
data.tar.gz: 217c3a359d809439a63d5288cd414c48bd3032956f48595f1d657e48923c4524b7b3b157d8d0a9f4c117192be3cc4d2134d905261b19436af8c9acb4bd5b406a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -70,7 +70,7 @@ The `-f` flag can be used to read the list of episodes to download from a file.
|
|
70
70
|
|
71
71
|
### Available link grabbers
|
72
72
|
|
73
|
-
With `-g` and `--show-grabbers`, the user can see what grabbers are available and choose one of these as their preferred option. By default, the application searches for torrents using
|
73
|
+
With `-g` and `--show-grabbers`, the user can see what grabbers are available and choose one of these as their preferred option. By default, the application searches for torrents using ThePirateBay. When a grabber doesn't have a torrent for said episode, is offline, or causes any error to appear, it skips to the next grabber until exhausting the list.
|
74
74
|
|
75
75
|
I usually publish a patch update to the gem when I detect one of them isn't working, disabling it or fixing it altogether. If a specific grabber is giving you problems, check whether you're running the latest version of the gem before opening an issue here.
|
76
76
|
|
data/download_tv.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.executables = ['tv']
|
23
23
|
|
24
24
|
s.add_development_dependency 'bundler', '~> 2.0'
|
25
|
+
s.add_development_dependency 'byebug', '~> 11.1'
|
25
26
|
s.add_development_dependency 'minitest', '~> 5.0'
|
26
|
-
s.add_development_dependency "rake", ">= 12.3.3"
|
27
27
|
s.add_development_dependency 'pry', '~> 0.13'
|
28
|
-
s.add_development_dependency '
|
28
|
+
s.add_development_dependency 'rake', '>= 12.3.3'
|
29
29
|
|
30
30
|
s.add_dependency('json')
|
31
31
|
s.add_dependency('mechanize')
|
@@ -140,7 +140,7 @@ module DownloadTV
|
|
140
140
|
# Maintains the previous values, in case it's an update from an existing file.
|
141
141
|
def set_default_values
|
142
142
|
self[:auto] ||= true
|
143
|
-
self[:grabber] ||= '
|
143
|
+
self[:grabber] ||= 'ThePirateBay'
|
144
144
|
self[:date] ||= Date.today - 1
|
145
145
|
self[:filters] ||= default_filters
|
146
146
|
self[:pending] ||= []
|
@@ -4,7 +4,7 @@ module DownloadTV
|
|
4
4
|
##
|
5
5
|
# ThePirateBay grabber
|
6
6
|
class ThePirateBay < LinkGrabber
|
7
|
-
def initialize(tpb_proxy = 'https://
|
7
|
+
def initialize(tpb_proxy = 'https://tpirbay.site/')
|
8
8
|
proxy = tpb_proxy.gsub(%r{/+$}, '')
|
9
9
|
|
10
10
|
super("#{proxy}/search/%s/0/7/0")
|
data/lib/download_tv/torrent.rb
CHANGED
data/lib/download_tv/version.rb
CHANGED
@@ -2,30 +2,26 @@
|
|
2
2
|
|
3
3
|
describe DownloadTV::Torrent do
|
4
4
|
let(:default_grabber) { nil }
|
5
|
-
let(:third_grabber) { double('eztv') }
|
6
|
-
let(:second_grabber) { double('
|
7
|
-
let(:
|
8
|
-
let(:first_grabber) { double('torrentgalaxy') }
|
5
|
+
# let(:third_grabber) { double('eztv') }
|
6
|
+
let(:second_grabber) { double('eztv') }
|
7
|
+
let(:first_grabber) { double('tpb') }
|
9
8
|
let(:test_show) { double('test_show') }
|
10
9
|
subject { described_class.new(default_grabber) }
|
11
10
|
|
12
11
|
before :each do
|
13
|
-
allow(DownloadTV::
|
14
|
-
allow(DownloadTV::
|
15
|
-
allow(DownloadTV::
|
16
|
-
# allow(DownloadTV::TorrentGalaxy).to receive(:new).and_return fourth_grabber
|
12
|
+
allow(DownloadTV::ThePirateBay).to receive(:new).and_return first_grabber
|
13
|
+
allow(DownloadTV::Eztv).to receive(:new).and_return second_grabber
|
14
|
+
# allow(DownloadTV::TorrentGalaxy).to receive(:new).and_return third_grabber
|
17
15
|
|
18
16
|
allow(first_grabber).to receive(:online?).and_return(true)
|
19
17
|
allow(second_grabber).to receive(:online?).and_return(true)
|
20
|
-
allow(third_grabber).to receive(:online?).and_return(true)
|
21
|
-
# allow(fourth_grabber).to receive(:online?).and_return(true)
|
18
|
+
# allow(third_grabber).to receive(:online?).and_return(true)
|
22
19
|
end
|
23
20
|
|
24
21
|
describe 'Torrent.grabbers' do
|
25
22
|
it 'returns the list of grabbers' do
|
26
23
|
# This order is assumed in the other specs, so explicitly checking it here
|
27
|
-
expect(described_class.grabbers).to eq %w[
|
28
|
-
|
24
|
+
expect(described_class.grabbers).to eq %w[ThePirateBay Eztv]
|
29
25
|
end
|
30
26
|
end
|
31
27
|
|
@@ -34,7 +30,7 @@ describe DownloadTV::Torrent do
|
|
34
30
|
result = double('result')
|
35
31
|
expect(first_grabber).to receive(:get_links).with(test_show).and_return(result)
|
36
32
|
|
37
|
-
|
33
|
+
subject.get_links(test_show)
|
38
34
|
end
|
39
35
|
|
40
36
|
context 'when the first grabber is offline' do
|
@@ -45,10 +41,10 @@ describe DownloadTV::Torrent do
|
|
45
41
|
it 'will use the second grabber' do
|
46
42
|
expect(first_grabber).not_to receive(:get_links)
|
47
43
|
expect(second_grabber).to receive(:get_links).with(test_show)
|
48
|
-
expect(third_grabber).not_to receive(:get_links)
|
44
|
+
# expect(third_grabber).not_to receive(:get_links)
|
49
45
|
# Add other torrents here with expectation #not_to receive
|
50
46
|
|
51
|
-
|
47
|
+
subject.get_links(test_show)
|
52
48
|
end
|
53
49
|
end
|
54
50
|
|
@@ -56,13 +52,13 @@ describe DownloadTV::Torrent do
|
|
56
52
|
before do
|
57
53
|
allow(first_grabber).to receive(:online?).and_return(false)
|
58
54
|
allow(second_grabber).to receive(:online?).and_return(false)
|
59
|
-
allow(third_grabber).to receive(:online?).and_return(false)
|
55
|
+
# allow(third_grabber).to receive(:online?).and_return(false)
|
60
56
|
end
|
61
57
|
|
62
58
|
it 'will exit' do
|
63
59
|
expect(first_grabber).not_to receive(:get_links)
|
64
60
|
expect(second_grabber).not_to receive(:get_links)
|
65
|
-
expect(third_grabber).not_to receive(:get_links)
|
61
|
+
# expect(third_grabber).not_to receive(:get_links)
|
66
62
|
|
67
63
|
expect { subject.get_links(test_show) }.to raise_error(SystemExit)
|
68
64
|
end
|
@@ -77,7 +73,7 @@ describe DownloadTV::Torrent do
|
|
77
73
|
expect(first_grabber).to receive(:get_links).ordered
|
78
74
|
expect(second_grabber).to receive(:get_links).ordered
|
79
75
|
|
80
|
-
|
76
|
+
subject.get_links(test_show)
|
81
77
|
end
|
82
78
|
end
|
83
79
|
|
@@ -85,13 +81,13 @@ describe DownloadTV::Torrent do
|
|
85
81
|
before do
|
86
82
|
allow(first_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
87
83
|
allow(second_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
88
|
-
allow(third_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
84
|
+
# allow(third_grabber).to receive(:get_links).with(test_show).and_raise(DownloadTV::NoTorrentsError)
|
89
85
|
end
|
90
86
|
|
91
87
|
it 'will return an empty array' do
|
92
88
|
expect(first_grabber).to receive(:get_links).ordered
|
93
89
|
expect(second_grabber).to receive(:get_links).ordered
|
94
|
-
expect(third_grabber).to receive(:get_links).ordered
|
90
|
+
# expect(third_grabber).to receive(:get_links).ordered
|
95
91
|
|
96
92
|
expect(subject.get_links(test_show)).to eq []
|
97
93
|
end
|
@@ -103,10 +99,10 @@ describe DownloadTV::Torrent do
|
|
103
99
|
it 'will use that grabber preferently' do
|
104
100
|
test_show = double('test_show')
|
105
101
|
expect(first_grabber).not_to receive(:get_links)
|
106
|
-
expect(second_grabber).
|
107
|
-
expect(third_grabber).to receive(:get_links).with(test_show)
|
102
|
+
expect(second_grabber).to receive(:get_links)
|
103
|
+
# expect(third_grabber).to receive(:get_links).with(test_show)
|
108
104
|
|
109
|
-
|
105
|
+
subject.get_links(test_show)
|
110
106
|
end
|
111
107
|
end
|
112
108
|
|
@@ -117,16 +113,15 @@ describe DownloadTV::Torrent do
|
|
117
113
|
count += 1
|
118
114
|
raise DownloadTV::NoTorrentsError if count == 1
|
119
115
|
end
|
120
|
-
|
121
116
|
end
|
122
117
|
|
123
118
|
it 'the second run will use the original order' do
|
124
119
|
expect(first_grabber).to receive(:get_links).exactly(2).times
|
125
120
|
expect(second_grabber).to receive(:get_links).exactly(1).time
|
126
|
-
expect(third_grabber).not_to receive(:get_links)
|
121
|
+
# expect(third_grabber).not_to receive(:get_links)
|
127
122
|
|
128
|
-
|
129
|
-
|
123
|
+
subject.get_links(test_show)
|
124
|
+
subject.get_links(test_show)
|
130
125
|
end
|
131
126
|
end
|
132
127
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: download_tv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- guille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '11.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.13'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 12.3.3
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 12.3.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,6 @@ files:
|
|
132
132
|
- lib/download_tv/filterer.rb
|
133
133
|
- lib/download_tv/grabbers/eztv.rb
|
134
134
|
- lib/download_tv/grabbers/torrentgalaxy.rb
|
135
|
-
- lib/download_tv/grabbers/torrentz.rb
|
136
135
|
- lib/download_tv/grabbers/tpb.rb
|
137
136
|
- lib/download_tv/grabbers/tpbapi.rb
|
138
137
|
- lib/download_tv/linkgrabber.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module DownloadTV
|
4
|
-
##
|
5
|
-
# Torrentz2 grabber
|
6
|
-
class Torrentz < LinkGrabber
|
7
|
-
def initialize
|
8
|
-
super('https://torrentz2.nz/search?q=%s')
|
9
|
-
end
|
10
|
-
|
11
|
-
def get_links(show)
|
12
|
-
raw_data = agent.get(format(@url, show))
|
13
|
-
results = raw_data.search('dl')
|
14
|
-
|
15
|
-
raise NoTorrentsError if results.empty?
|
16
|
-
|
17
|
-
data = results.sort_by { |e| e.search('dd span')[3].text.to_i }.reverse
|
18
|
-
|
19
|
-
data.collect do |i|
|
20
|
-
[i.children[0].text.strip,
|
21
|
-
i.search('dd span a').first.attribute('href').text]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|