viddl-rb 0.98 → 0.99

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- data.tar.gz: 8a400ba81f44686ac1d23b19efaa1e37e76c98b1
4
- metadata.gz: f8dc72f7877933446a2a0c243e5ea6205a8a13c5
3
+ metadata.gz: 869f88d6332b09dea9e9c01d3205a1965b9c8c48
4
+ data.tar.gz: f208de4df1e7fb57d66e2e005aee7f1dbda147f6
5
5
  SHA512:
6
- data.tar.gz: 868498697d3850fe3d11071e6a4375a4215e6313a685cba072ac9f1318dbf6fe34b3fbdc3067bce13454697ce1720b94081442c552d5f2a8d630d67d81a4695c
7
- metadata.gz: f0d977af3eb3a90ecdf5dbdc82e411051dba179807adeafc8cb8a3a5f07addd77ed9550fb9aa2af18379537678a98a754d24c258151fe6d70a85b97f63e3356d
6
+ metadata.gz: c656fa95771d40f473c698a46fa6395129b6ad5100794479a245d1ade7c51d7d0131077baae825ecf120925abc67c62a24a3924d0470b91b26e5b92d8b165784
7
+ data.tar.gz: 01be0e2e4510fc211f8661999e5d34f2e74c4582a57ce05619babb2f80b9c48c34a448c669e5f873db5ef250e1f27789932e658e3400ac4fd03019c32dd4c404
data/README.md CHANGED
@@ -119,9 +119,8 @@ end
119
119
 
120
120
  __Requirements:__
121
121
 
122
- * curl/wget or the [progress bar](http://github.com/nex3/ruby-progressbar/) gem
122
+ * curl/wget/aria2c or the [progress bar](http://github.com/nex3/ruby-progressbar/) gem
123
123
  * [Nokogiri](http://nokogiri.org/)
124
- * [Mechanize](http://mechanize.rubyforge.org/)
125
124
  * ffmpeg if you want to extract audio tracks from the videos
126
125
 
127
126
  __Co Maintainers:__
data/Rakefile CHANGED
@@ -2,8 +2,8 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'rake/testtask'
4
4
 
5
- ALL_INTEGRATION = FileList["spec/integration/*.rb"]
6
- ALL_UNIT = FileList["spec/unit/*/*.rb"]
5
+ ALL_INTEGRATION = FileList["spec/integration/*.rb", "spec/integration/*/*.rb"]
6
+ ALL_UNIT = FileList["spec/unit/*/*.rb"]
7
7
 
8
8
  task :default => [:all]
9
9
 
@@ -30,3 +30,7 @@ end
30
30
  Rake::TestTask.new(:test_download) do |t|
31
31
  t.test_files = FileList["spec/integration/download_spec.rb"]
32
32
  end
33
+
34
+ Rake::TestTask.new(:test_cipher_loader) do |t|
35
+ t.test_files = FileList["spec/integration/youtube/cipher_loader_spec.rb"]
36
+ end
@@ -48,6 +48,10 @@ module ViddlRb
48
48
  end
49
49
  end
50
50
 
51
+ def self.base_path
52
+ File.join(File.dirname(File.expand_path(__FILE__)), "..")
53
+ end
54
+
51
55
  #checks to see whether the os has a certain utility like wget or curl
52
56
  #`` returns the standard output of the process
53
57
  #system returns the exit code of the process
data/plugins/youtube.rb CHANGED
@@ -9,7 +9,7 @@ class Youtube < PluginBase
9
9
  def self.get_urls_and_filenames(url, options = {})
10
10
 
11
11
  @url_resolver = UrlResolver.new
12
- @video_resolver = VideoResolver.new(Decipherer.new)
12
+ @video_resolver = VideoResolver.new(Decipherer.new(CipherLoader.new))
13
13
  @format_picker = FormatPicker.new(options)
14
14
 
15
15
  urls = @url_resolver.get_all_urls(url, options[:filter])
@@ -0,0 +1,62 @@
1
+
2
+ require 'open-uri'
3
+ require 'net/http'
4
+ require 'openssl'
5
+ require 'yaml'
6
+
7
+ class CipherLoader
8
+
9
+ CIPHER_YAML_URL = "https://raw.github.com/rb2k/viddl-rb/master/plugins/youtube/ciphers.yml"
10
+ CIPHER_YAML_PATH = File.join(ViddlRb::UtilityHelper.base_path, "plugins/youtube/ciphers.yml")
11
+
12
+ def initialize
13
+ @ciphers = YAML.load_file(CIPHER_YAML_PATH)
14
+ end
15
+
16
+ def load_ciphers
17
+ begin
18
+ update_ciphers
19
+ rescue => e
20
+ Youtube.notify "Error updating ciphers: #{e.message}. Continuing..."
21
+ end
22
+
23
+ @ciphers.dup
24
+ end
25
+
26
+ private
27
+
28
+ def update_ciphers
29
+ return if get_server_file_size == get_local_file_size
30
+
31
+ @ciphers.merge!(download_server_ciphers)
32
+ save_local_ciphers(@ciphers)
33
+ end
34
+
35
+ def get_local_file_size
36
+ File.size(CIPHER_YAML_PATH)
37
+ end
38
+
39
+ def get_server_file_size
40
+ uri = URI.parse(CIPHER_YAML_URL)
41
+ http = make_http(uri)
42
+ head = Net::HTTP::Head.new(uri.request_uri)
43
+ http.request(head)["Content-Length"].to_i
44
+ end
45
+
46
+ def make_http(uri)
47
+ http = Net::HTTP.new(uri.host, uri.port)
48
+ http.use_ssl = true
49
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
50
+ http.open_timeout = 2
51
+ http.read_timeout = 2
52
+ http
53
+ end
54
+
55
+ def download_server_ciphers
56
+ YAML.load(open(CIPHER_YAML_URL).read)
57
+ end
58
+
59
+ def save_local_ciphers(ciphers)
60
+ File.write(CIPHER_YAML_PATH, ciphers.to_yaml)
61
+ end
62
+ end
@@ -0,0 +1,86 @@
1
+ ---
2
+ vflNzKG7n: s3 r s2 r s1 r w67
3
+ vfllMCQWM: s2 w46 r w27 s2 w43 s2 r
4
+ vflJv8FA8: s1 w51 w52 r
5
+ vflR_cX32: s2 w64 s3
6
+ vflveGye9: w21 w3 s1 r w44 w36 r w41 s1
7
+ vflj7Fxxt: r s3 w3 r w17 r w41 r s2
8
+ vfltM3odl: w60 s1 w49 r s1 w7 r s2 r
9
+ vflDG7-a-: w52 r s3 w21 r s3 r
10
+ vfl39KBj1: w52 r s3 w21 r s3 r
11
+ vflmOfVEX: w52 r s3 w21 r s3 r
12
+ vflJwJuHJ: r s3 w19 r s2
13
+ vfl_ymO4Z: r s3 w19 r s2
14
+ vfl26ng3K: r s2 r
15
+ vflcaqGO8: w24 w53 s2 w31 w4
16
+ vflQw-fB4: s2 r s3 w9 s3 w43 s3 r w23
17
+ vflSAFCP9: r s2 w17 w61 r s1 w7 s1
18
+ vflART1Nf: s3 r w63 s2 r s1
19
+ vflLC8JvQ: w34 w29 w9 r w39 w24
20
+ vflm_D8eE: s2 r w39 w55 w49 s3 w56 w2
21
+ vflTWC9KW: r s2 w65 r
22
+ vflRFcHMl: s3 w24 r
23
+ vflM2EmfJ: w10 r s1 w45 s2 r s3 w50 r
24
+ vflz8giW0: s2 w18 s3
25
+ vfl_wGgYV: w60 s1 r s1 w9 s3 r s3 r
26
+ vfl1HXdPb: w52 r w18 r s1 w44 w51 r s1
27
+ vflkn6DAl: w39 s2 w57 s2 w23 w35 s2
28
+ vfl2LOvBh: w34 w19 r s1 r s3 w24 r
29
+ vfl-bxy_m: w48 s3 w37 s2
30
+ vflZK4ZYR: w19 w68 s1
31
+ vflh9ybst: w48 s3 w37 s2
32
+ vflapUV9V: s2 w53 r w59 r s2 w41 s3
33
+ vflg0g8PQ: w36 s3 r s2
34
+ vflHOr_nV: w58 r w50 s1 r s1 r w11 s3
35
+ vfluy6kdb: r w12 w32 r w34 s3 w35 w42 s2
36
+ vflkuzxcs: w22 w43 s3 r s1 w43
37
+ vflGNjMhJ: w43 w2 w54 r w8 s1
38
+ vfldJ8xgI: w11 r w29 s1 r s3
39
+ vfl79wBKW: s3 r s1 r s3 r s3 w59 s2
40
+ vflg3FZfr: r s3 w66 w10 w43 s2
41
+ vflUKrNpT: r s2 r w63 r
42
+ vfldWnjUz: r s1 w68
43
+ vflP7iCEe: w7 w37 r s1
44
+ vflzVne63: w59 s2 r
45
+ vflO-N-9M: w9 s1 w67 r s3
46
+ vflZ4JlpT: s3 r s1 r w28 s1
47
+ vflDgXSDS: s3 r s1 r w28 s1
48
+ vflW444Sr: r w9 r s1 w51 w27 r s1 r
49
+ vflK7RoTQ: w44 r w36 r w45
50
+ vflKOCFq2: s1 r w41 r w41 s1 w15
51
+ vflcLL31E: s1 r w41 r w41 s1 w15
52
+ vflz9bT3N: s1 r w41 r w41 s1 w15
53
+ vfliZsE79: r s3 w49 s3 r w58 s2 r s2
54
+ vfljOFtAt: r s3 r s1 r w69 r
55
+ vflqSl9GX: w32 r s2 w65 w26 w45 w24 w40 s2
56
+ vflFrKymJ: w32 r s2 w65 w26 w45 w24 w40 s2
57
+ vflKz4WoM: w50 w17 r w7 w65
58
+ vflhdWW8S: s2 w55 w10 s3 w57 r w25 w41
59
+ vfl66X2C5: r s2 w34 s2 w39
60
+ vflCXG8Sm: r s2 w34 s2 w39
61
+ vfl_3Uag6: w3 w7 r s2 w27 s2 w42 r
62
+ vflQdXVwM: s1 r w66 s2 r w12
63
+ vflCtc3aO: s2 r w11 r s3 w28
64
+ vflCt6YZX: s2 r w11 r s3 w28
65
+ vflG49soT: w32 r s3 r s1 r w19 w24 s3
66
+ vfl4cHApe: w25 s1 r s1 w27 w21 s1 w39
67
+ vflwMrwdI: w3 r w39 r w51 s1 w36 w14
68
+ vfl4AMHqP: r s1 w1 r w43 r s1 r
69
+ vfln8xPyM: w36 w14 s1 r s1 w54
70
+ vflVSLmnY: s3 w56 w10 r s2 r w28 w35
71
+ vflkLvpg7: w4 s3 w53 s2
72
+ vflbxes4n: w4 s3 w53 s2
73
+ vflmXMtFI: w57 s3 w62 w41 s3 r w60 r
74
+ vflYDqEW1: w24 s1 r s2 w31 w4 w11 r
75
+ vflapGX6Q: s3 w2 w59 s2 w68 r s3 r s1
76
+ vflLCYwkM: s3 w2 w59 s2 w68 r s3 r s1
77
+ vflcY_8N0: s2 w36 s1 r w18 r w19 r
78
+ vfl9qWoOL: w68 w64 w28 r
79
+ vfle-mVwz: s3 w7 r s3 r w14 w59 s3 r
80
+ vfltdb6U3: w61 w5 r s2 w69 s2 r
81
+ vflLjFx3B: w40 w62 r s2 w21 s3 r w7 s3
82
+ vfliqjKfF: w40 w62 r s2 w21 s3 r w7 s3
83
+ ima-vflxBu-5R: w40 w62 r s2 w21 s3 r w7 s3
84
+ ima-vflrGwWV9: w36 w45 r s2 r
85
+ ima-vflCME3y0: w8 s2 r w52
86
+ ima-vfl1LZyZ5: w8 s2 r w52
@@ -2,97 +2,14 @@
2
2
  class Decipherer
3
3
 
4
4
  class UnknownCipherVersionError < StandardError; end
5
- class UnknownCipherOperationError < StandardError; end
5
+ class UnknownCipherOperationError < StandardError; end
6
6
 
7
- CIPHERS = {
8
- 'vflNzKG7n' => 's3 r s2 r s1 r w67', # 30 Jan 2013, untested
9
- 'vfllMCQWM' => 's2 w46 r w27 s2 w43 s2 r', # 15 Feb 2013, untested
10
- 'vflJv8FA8' => 's1 w51 w52 r', # 12 Mar 2013, untested
11
- 'vflR_cX32' => 's2 w64 s3', # 11 Apr 2013, untested
12
- 'vflveGye9' => 'w21 w3 s1 r w44 w36 r w41 s1', # 02 May 2013, untested
13
- 'vflj7Fxxt' => 'r s3 w3 r w17 r w41 r s2', # 14 May 2013, untested
14
- 'vfltM3odl' => 'w60 s1 w49 r s1 w7 r s2 r', # 23 May 2013
15
- 'vflDG7-a-' => 'w52 r s3 w21 r s3 r', # 06 Jun 2013
16
- 'vfl39KBj1' => 'w52 r s3 w21 r s3 r', # 12 Jun 2013
17
- 'vflmOfVEX' => 'w52 r s3 w21 r s3 r', # 21 Jun 2013
18
- 'vflJwJuHJ' => 'r s3 w19 r s2', # 25 Jun 2013
19
- 'vfl_ymO4Z' => 'r s3 w19 r s2', # 26 Jun 2013
20
- 'vfl26ng3K' => 'r s2 r', # 08 Jul 2013
21
- 'vflcaqGO8' => 'w24 w53 s2 w31 w4', # 11 Jul 2013
22
- 'vflQw-fB4' => 's2 r s3 w9 s3 w43 s3 r w23', # 16 Jul 2013
23
- 'vflSAFCP9' => 'r s2 w17 w61 r s1 w7 s1', # 18 Jul 2013
24
- 'vflART1Nf' => 's3 r w63 s2 r s1', # 22 Jul 2013
25
- 'vflLC8JvQ' => 'w34 w29 w9 r w39 w24', # 25 Jul 2013
26
- 'vflm_D8eE' => 's2 r w39 w55 w49 s3 w56 w2', # 30 Jul 2013
27
- 'vflTWC9KW' => 'r s2 w65 r', # 31 Jul 2013
28
- 'vflRFcHMl' => 's3 w24 r', # 04 Aug 2013
29
- 'vflM2EmfJ' => 'w10 r s1 w45 s2 r s3 w50 r', # 06 Aug 2013
30
- 'vflz8giW0' => 's2 w18 s3', # 07 Aug 2013
31
- 'vfl_wGgYV' => 'w60 s1 r s1 w9 s3 r s3 r', # 08 Aug 2013
32
- 'vfl1HXdPb' => 'w52 r w18 r s1 w44 w51 r s1', # 12 Aug 2013
33
- 'vflkn6DAl' => 'w39 s2 w57 s2 w23 w35 s2', # 15 Aug 2013
34
- 'vfl2LOvBh' => 'w34 w19 r s1 r s3 w24 r', # 16 Aug 2013
35
- 'vfl-bxy_m' => 'w48 s3 w37 s2', # 20 Aug 2013
36
- 'vflZK4ZYR' => 'w19 w68 s1', # 21 Aug 2013
37
- 'vflh9ybst' => 'w48 s3 w37 s2', # 21 Aug 2013
38
- 'vflapUV9V' => 's2 w53 r w59 r s2 w41 s3', # 27 Aug 2013
39
- 'vflg0g8PQ' => 'w36 s3 r s2', # 28 Aug 2013
40
- 'vflHOr_nV' => 'w58 r w50 s1 r s1 r w11 s3', # 30 Aug 2013
41
- 'vfluy6kdb' => 'r w12 w32 r w34 s3 w35 w42 s2', # 05 Sep 2013
42
- 'vflkuzxcs' => 'w22 w43 s3 r s1 w43', # 10 Sep 2013
43
- 'vflGNjMhJ' => 'w43 w2 w54 r w8 s1', # 12 Sep 2013
44
- 'vfldJ8xgI' => 'w11 r w29 s1 r s3', # 17 Sep 2013
45
- 'vfl79wBKW' => 's3 r s1 r s3 r s3 w59 s2', # 19 Sep 2013
46
- 'vflg3FZfr' => 'r s3 w66 w10 w43 s2', # 24 Sep 2013
47
- 'vflUKrNpT' => 'r s2 r w63 r', # 25 Sep 2013
48
- 'vfldWnjUz' => 'r s1 w68', # 30 Sep 2013
49
- 'vflP7iCEe' => 'w7 w37 r s1', # 03 Oct 2013
50
- 'vflzVne63' => 'w59 s2 r', # 07 Oct 2013
51
- 'vflO-N-9M' => 'w9 s1 w67 r s3', # 09 Oct 2013
52
- 'vflZ4JlpT' => 's3 r s1 r w28 s1', # 11 Oct 2013
53
- 'vflDgXSDS' => 's3 r s1 r w28 s1', # 15 Oct 2013
54
- 'vflW444Sr' => 'r w9 r s1 w51 w27 r s1 r', # 17 Oct 2013
55
- 'vflK7RoTQ' => 'w44 r w36 r w45', # 21 Oct 2013
56
- 'vflKOCFq2' => 's1 r w41 r w41 s1 w15', # 23 Oct 2013
57
- 'vflcLL31E' => 's1 r w41 r w41 s1 w15', # 28 Oct 2013
58
- 'vflz9bT3N' => 's1 r w41 r w41 s1 w15', # 31 Oct 2013
59
- 'vfliZsE79' => 'r s3 w49 s3 r w58 s2 r s2', # 05 Nov 2013
60
- 'vfljOFtAt' => 'r s3 r s1 r w69 r', # 07 Nov 2013
61
- 'vflqSl9GX' => 'w32 r s2 w65 w26 w45 w24 w40 s2', # 14 Nov 2013
62
- 'vflFrKymJ' => 'w32 r s2 w65 w26 w45 w24 w40 s2', # 15 Nov 2013
63
- 'vflKz4WoM' => 'w50 w17 r w7 w65', # 19 Nov 2013
64
- 'vflhdWW8S' => 's2 w55 w10 s3 w57 r w25 w41', # 21 Nov 2013
65
- 'vfl66X2C5' => 'r s2 w34 s2 w39', # 26 Nov 2013
66
- 'vflCXG8Sm' => 'r s2 w34 s2 w39', # 02 Dec 2013
67
- 'vfl_3Uag6' => 'w3 w7 r s2 w27 s2 w42 r', # 04 Dec 2013
68
- 'vflQdXVwM' => 's1 r w66 s2 r w12', # 10 Dec 2013
69
- 'vflCtc3aO' => 's2 r w11 r s3 w28', # 12 Dec 2013
70
- 'vflCt6YZX' => 's2 r w11 r s3 w28', # 17 Dec 2013
71
- 'vflG49soT' => 'w32 r s3 r s1 r w19 w24 s3', # 18 Dec 2013
72
- 'vfl4cHApe' => 'w25 s1 r s1 w27 w21 s1 w39', # 06 Jan 2014
73
- 'vflwMrwdI' => 'w3 r w39 r w51 s1 w36 w14', # 06 Jan 2014
74
- 'vfl4AMHqP' => 'r s1 w1 r w43 r s1 r', # 09 Jan 2014
75
- 'vfln8xPyM' => 'w36 w14 s1 r s1 w54', # 10 Jan 2014
76
- 'vflVSLmnY' => 's3 w56 w10 r s2 r w28 w35', # 13 Jan 2014
77
- 'vflkLvpg7' => 'w4 s3 w53 s2', # 15 Jan 2014
78
- 'vflbxes4n' => 'w4 s3 w53 s2', # 15 Jan 2014
79
- 'vflmXMtFI' => 'w57 s3 w62 w41 s3 r w60 r', # 23 Jan 2014
80
- 'vflYDqEW1' => 'w24 s1 r s2 w31 w4 w11 r', # 24 Jan 2014
81
- 'vflapGX6Q' => 's3 w2 w59 s2 w68 r s3 r s1', # 28 Jan 2014
82
- 'vflLCYwkM' => 's3 w2 w59 s2 w68 r s3 r s1', # 29 Jan 2014
83
- 'vflcY_8N0' => 's2 w36 s1 r w18 r w19 r', # 30 Jan 2014
84
- 'vfl9qWoOL' => 'w68 w64 w28 r', # 03 Feb 2014
85
- 'vfle-mVwz' => 's3 w7 r s3 r w14 w59 s3 r', # 04 Feb 2014
86
- 'vfltdb6U3' => 'w61 w5 r s2 w69 s2 r', # 05 Feb 2014
87
- 'vflLjFx3B' => 'w40 w62 r s2 w21 s3 r w7 s3', # 10 Feb 2014
88
- 'vfliqjKfF' => 'w40 w62 r s2 w21 s3 r w7 s3', # 13 Feb 2014
89
- 'ima-vflxBu-5R' => 'w40 w62 r s2 w21 s3 r w7 s3', # 13 Feb 2014
90
- 'ima-vflrGwWV9' => 'w36 w45 r s2 r', # 20 Feb 2014
91
- 'ima-vflCME3y0' => 'w8 s2 r w52' # 27 Feb 2014
92
- }
7
+ def initialize(loader)
8
+ @ciphers = loader.load_ciphers
9
+ end
93
10
 
94
11
  def decipher_with_version(cipher, cipher_version)
95
- operations = CIPHERS[cipher_version]
12
+ operations = @ciphers[cipher_version]
96
13
  raise UnknownCipherVersionError.new("Unknown cipher version: #{cipher_version}") unless operations
97
14
 
98
15
  decipher_with_operations(cipher, operations.split)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viddl-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.98"
4
+ version: "0.99"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Seeger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-02-27 00:00:00 Z
12
+ date: 2014-03-02 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mime-types
@@ -95,6 +95,8 @@ files:
95
95
  - plugins/soundcloud.rb
96
96
  - plugins/veoh.rb
97
97
  - plugins/vimeo.rb
98
+ - plugins/youtube/cipher_loader.rb
99
+ - plugins/youtube/ciphers.yml
98
100
  - plugins/youtube/decipherer.rb
99
101
  - plugins/youtube/format_picker.rb
100
102
  - plugins/youtube/url_resolver.rb