youtube-dl.rb 0.2.3.2015.10.24 → 0.2.4.2015.10.24

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
- metadata.gz: f84b679cf5fdaf07df79d63a0bea60581437e7f6
4
- data.tar.gz: d47c54582881bdbda2c16b2fc5791a6c1b5a4d48
3
+ metadata.gz: d74cb3bb82668e70c653d638cf41ee649eaa7a9a
4
+ data.tar.gz: 6ba3751db73de31773169515921c50766519d221
5
5
  SHA512:
6
- metadata.gz: 793a6beeb1db594fb23557188bd285420463c4b56d7117e10361209e2f2860ab961e59dd4d3aec569dbba6bee220c70cba10fb57e2471f71ace2b222de68b2f4
7
- data.tar.gz: 3a1e7c289112aee97560df754618bbb1c08811c95557f6f9bb83eca52b0fa1232435fe0f1ad7f2d115c75182c7c962b79dabc902841a810b26738fa279006f29
6
+ metadata.gz: c0f453a8ca645767ec6c3d477960c4c41fe322297b001845cb6f4e76ff040c64b13d44f4db0f4d4f19bcb674fb882f64bf8b2789d1292cc1ee8535f25e1ba9a0
7
+ data.tar.gz: 6439079e4ed501bdbe2a3d9cb649178bec79035de392b1d92e63b01a6a722d6351f9fe5c65daa1acd0105035a8d20c75542fcf7457952c8058cc2f85b9c7b655
data/.travis.yml CHANGED
@@ -1,10 +1,13 @@
1
- before_install: 'sudo chmod 755 ./vendor/bin/youtube-dl'
1
+ before_install:
2
+ - sudo chmod 755 ./vendor/bin/youtube-dl
3
+ - sudo apt-get update -qq
4
+
2
5
  rvm:
3
- - 1.9.3 # EOL, but still supporting
4
- - 2.0.0 # Oldest stable
5
- - 2.2.3 # Current stable
6
- - jruby-head # JRuby
7
- - rbx-2 # Rubinius
6
+ - 1.9.3 # EOL, but still supporting
7
+ - 2.0.0 # Oldest stable
8
+ - 2.2.3 # Current stable
9
+ - jruby-head # JRuby
10
+ - rbx-2 # Rubinius
8
11
 
9
12
  notifications:
10
13
  slack: layer8x:cvixULdjCINfq7u9Zs1rS0VY
data/README.md CHANGED
@@ -33,6 +33,8 @@ Or install it yourself as:
33
33
  ## Install youtube-dl
34
34
  This gem ships with the latest (working) version of youtube-dl built-in, so you don't have to install youtube-dl at all! Unless you want to.
35
35
 
36
+ Some features of youtube-dl require ffmpeg or avconf to be installed. Normally these are available for installation from your distribution's repositories.
37
+
36
38
  ## Usage
37
39
 
38
40
  Pretty simple.
@@ -45,7 +45,7 @@ module YoutubeDL
45
45
  if output.include? 'Merging formats into'
46
46
  output.scan(/Merging formats into \"(.*)\"/)[0][0]
47
47
  else
48
- output.scan(/\[download\] Destination:\s(.*)$/)[0][0]
48
+ output.scan(/\[.*\] Destination:\s(.*)$/).last.last
49
49
  end
50
50
  end
51
51
  rescue NoMethodError # There wasn't a match somewhere. Kill it with fire
@@ -1,5 +1,5 @@
1
1
  module YoutubeDL
2
2
  # Semantic Version as well as the bundled binary version.
3
3
  # "(semver)(pre-release)(binary-version)"
4
- VERSION = '0.2.3.2015.10.24'
4
+ VERSION = '0.2.4.2015.10.24'
5
5
  end
@@ -32,6 +32,8 @@ module YoutubeDL
32
32
 
33
33
  # Download the video.
34
34
  def download
35
+ raise ArgumentError.new('url cannot be nil') if url.nil?
36
+ raise ArgumentError.new('url cannot be empty') if url.empty?
35
37
  @download_options = YoutubeDL::Options.new(runner_options)
36
38
  @last_download_output = YoutubeDL::Runner.new(url, @download_options).run
37
39
  end
data/test/fixtures.yml CHANGED
@@ -29,6 +29,17 @@
29
29
  [youtube] gvdf5n-zI14: Downloading DASH manifest
30
30
  [download] nope.avi-gvdf5n-zI14.mp4 has already been downloaded
31
31
  [download] 100% of 1.31MiB
32
+ :download_audio: |
33
+ [youtube] gvdf5n-zI14: Downloading webpage
34
+ [youtube] gvdf5n-zI14: Downloading video info webpage
35
+ [youtube] gvdf5n-zI14: Extracting video information
36
+ [youtube] gvdf5n-zI14: Downloading DASH manifest
37
+ [youtube] gvdf5n-zI14: Downloading DASH manifest
38
+ [download] Destination: nope-gvdf5n-zI14.m4a
39
+ [download] Download completed
40
+ [ffmpeg] Correcting container in "nope-gvdf5n-zI14.m4a"
41
+ [ffmpeg] Destination: nope-gvdf5n-zI14.mp3
42
+ Deleting original file nope-gvdf5n-zI14.m4a (pass -k to keep)
32
43
  :list_formats: "[youtube] gvdf5n-zI14: Downloading webpage\n[youtube] gvdf5n-zI14:
33
44
  Downloading video info webpage\n[youtube] gvdf5n-zI14: Extracting video information\n[youtube]
34
45
  gvdf5n-zI14: Downloading DASH manifest\n[youtube] gvdf5n-zI14: Downloading DASH
data/test/test_helper.rb CHANGED
@@ -18,6 +18,7 @@ require 'yaml'
18
18
 
19
19
  require 'youtube-dl'
20
20
 
21
+ TEST_ID = "gvdf5n-zI14"
21
22
  TEST_URL = "https://www.youtube.com/watch?feature=endscreen&v=gvdf5n-zI14"
22
23
  TEST_URL2 = "https://www.youtube.com/watch?v=Mt0PUjh-nDM"
23
24
  TEST_FILENAME = "nope.avi.mp4"
@@ -33,18 +33,21 @@ describe YoutubeDL::Output do
33
33
  @parser_download = YoutubeDL::Output.new(fixture(:output, :download))
34
34
  @parser_download_ffmpeg = YoutubeDL::Output.new(fixture(:output, :download_ffmpeg))
35
35
  @parser_download_exists = YoutubeDL::Output.new(fixture(:output, :download_exists))
36
+ @parser_download_audio = YoutubeDL::Output.new(fixture(:output, :download_audio))
36
37
  end
37
38
 
38
39
  it 'should find a match given the correct output' do
39
40
  refute_nil @parser_download.filename
40
41
  refute_nil @parser_download_ffmpeg.filename
41
42
  refute_nil @parser_download_exists.filename
43
+ refute_nil @parser_download_audio.filename
42
44
  end
43
45
 
44
46
  it 'should find the correct match' do
45
47
  assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download.filename
46
48
  assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download_ffmpeg.filename
47
49
  assert_equal 'nope.avi-gvdf5n-zI14.mp4', @parser_download_exists.filename
50
+ assert_equal 'nope-gvdf5n-zI14.mp3', @parser_download_audio.filename
48
51
  end
49
52
 
50
53
  it 'should return nil if no match or wrong log format' do
@@ -54,6 +54,16 @@ describe YoutubeDL::Video do
54
54
  @video.download
55
55
  assert_equal Dir.glob(TEST_GLOB).first, @video.filename
56
56
  end
57
+
58
+ it 'should raise ArgumentError if url is nil or empty' do
59
+ assert_raises ArgumentError do
60
+ YoutubeDL::Video.new(nil).download
61
+ end
62
+
63
+ assert_raises ArgumentError do
64
+ YoutubeDL::Video.new('').download
65
+ end
66
+ end
57
67
  end
58
68
 
59
69
  describe '#formats' do
@@ -100,5 +110,16 @@ describe YoutubeDL::Video do
100
110
  @video.download
101
111
  assert_equal TEST_FILENAME, @video.filename
102
112
  end
113
+
114
+ # Broken on Travis. Output test should be fine.
115
+ # it 'should give the correct filename when run through ffmpeg' do
116
+ # @video.configure do |c|
117
+ # c.output = 'nope-%(id)s.%(ext)s'
118
+ # c.extract_audio = true
119
+ # c.audio_format = 'mp3'
120
+ # end
121
+ # @video.download
122
+ # assert_equal "nope-#{TEST_ID}.mp3", @video.filename
123
+ # end
103
124
  end
104
125
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube-dl.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3.2015.10.24
4
+ version: 0.2.4.2015.10.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - sapslaj
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-23 00:00:00.000000000 Z
12
+ date: 2015-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cocaine