youtube-dl.rb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.travis.yml +1 -1
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +5 -19
- data/Rakefile +19 -0
- data/lib/youtube-dl/options.rb +0 -0
- data/lib/youtube-dl/runner.rb +15 -1
- data/lib/youtube-dl/version.rb +1 -1
- data/lib/youtube-dl.rb +0 -0
- data/test/test_helper.rb +2 -0
- data/test/youtube-dl/options_test.rb +0 -0
- data/test/youtube-dl/runner_test.rb +2 -2
- data/test/youtube-dl/youtube-dl_test.rb +0 -0
- data/vendor/bin/youtube-dl +0 -0
- data/vendor/bin/youtube-dl.exe +0 -0
- data/youtube-dl.rb.gemspec +1 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8aa4aaf1fec27c155961efff901ade4498033d3
|
4
|
+
data.tar.gz: caf564fb87360422cbfaedacf413aa3dc7929a41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a5112701f59e6b028a329000e056c70b3f1575d70cb3517c8c6ca07fc7d23c42e16c002a13df663c07bf6b64dc21b98fae3063fc07bbb7d39541cc281da4c6
|
7
|
+
data.tar.gz: 84321d4274729c199d4c9f893b71205b0c8bb46bba71f2185bdd2c2073f44ac5c464a054ad17ff3fe9d46060dbe2fa1c843d95e98a0dfd485a35027f129fae13
|
data/.gitignore
CHANGED
File without changes
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -3,25 +3,6 @@
|
|
3
3
|
Ruby wrapper for [youtube-dl](http://rg3.github.io/youtube-dl/).
|
4
4
|
[![Build Status](https://travis-ci.org/layer8x/youtube-dl.rb.svg?branch=master)](https://travis-ci.org/layer8x/youtube-dl.rb)
|
5
5
|
|
6
|
-
## Installing youtube-dl
|
7
|
-
This gem does not ship with the `youtube-dl` command-line program (yet!) so you will need to install `youtube-dl` manually. Luckily there are three ways to do it.
|
8
|
-
|
9
|
-
### The easy way
|
10
|
-
Use your distro's package manager!
|
11
|
-
|
12
|
-
$ apt-get install youtube-dl
|
13
|
-
$ brew install youtube-dl
|
14
|
-
|
15
|
-
Or through Pip
|
16
|
-
|
17
|
-
$ pip install youtube-dl
|
18
|
-
|
19
|
-
### The slightly harder way
|
20
|
-
```bash
|
21
|
-
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
|
22
|
-
sudo chmod a+x /usr/local/bin/youtube-dl
|
23
|
-
```
|
24
|
-
|
25
6
|
## Install the gem
|
26
7
|
|
27
8
|
Add this line to your application's Gemfile:
|
@@ -38,6 +19,9 @@ Or install it yourself as:
|
|
38
19
|
|
39
20
|
$ gem install youtube-dl.rb
|
40
21
|
|
22
|
+
## Install youtube-dl
|
23
|
+
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.
|
24
|
+
|
41
25
|
## Usage
|
42
26
|
|
43
27
|
Pretty simple.
|
@@ -67,3 +51,5 @@ YoutubeDL.download "https://www.youtube.com/watch?v=gvdf5n-zI14", options
|
|
67
51
|
4. Pass test suite (`rake test`)
|
68
52
|
5. Push to the branch (`git push origin my-new-feature`)
|
69
53
|
6. Create a new Pull Request
|
54
|
+
|
55
|
+
Remember: commit now, commit often.
|
data/Rakefile
CHANGED
@@ -6,3 +6,22 @@ Rake::TestTask.new do |t|
|
|
6
6
|
end
|
7
7
|
|
8
8
|
task :default => [:test]
|
9
|
+
|
10
|
+
namespace :binaries do
|
11
|
+
def get_binaries(version)
|
12
|
+
puts "Updating python script"
|
13
|
+
system("wget -O ./vendor/bin/youtube-dl https://yt-dl.org/downloads/#{version}/youtube-dl")
|
14
|
+
puts "Updating Windows EXE"
|
15
|
+
system("wget -O ./vendor/bin/youtube-dl.exe https://yt-dl.org/downloads/#{version}/youtube-dl.exe")
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Get latest binaries"
|
19
|
+
task :latest do
|
20
|
+
get_binaries('latest')
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Get binaries for specific version (run with `rake binaries:version[2015.07.07]`)"
|
24
|
+
task :version, [:ver] do |t, a|
|
25
|
+
get_binaries(a[:ver])
|
26
|
+
end
|
27
|
+
end
|
data/lib/youtube-dl/options.rb
CHANGED
File without changes
|
data/lib/youtube-dl/runner.rb
CHANGED
@@ -13,7 +13,7 @@ module YoutubeDL
|
|
13
13
|
def initialize(url, options=YoutubeDL::Options.new)
|
14
14
|
@url = url
|
15
15
|
@options = YoutubeDL::Options.new(options.to_hash)
|
16
|
-
@executable_path =
|
16
|
+
@executable_path = usable_executable_path
|
17
17
|
end
|
18
18
|
|
19
19
|
# Returns Cocaine's runner engine
|
@@ -68,5 +68,19 @@ module YoutubeDL
|
|
68
68
|
def cocaine_line(command)
|
69
69
|
Cocaine::CommandLine.new(@executable_path, command)
|
70
70
|
end
|
71
|
+
|
72
|
+
# Returns a usable executable (system or vendor)
|
73
|
+
#
|
74
|
+
# @return [String] youtube-dl executable path
|
75
|
+
def usable_executable_path
|
76
|
+
system_path = `which youtube-dl`
|
77
|
+
if $?.exitstatus == 0
|
78
|
+
system_path
|
79
|
+
else
|
80
|
+
vendor_path = File.absolute_path("#{__FILE__}/../../../vendor/bin/youtube-dl")
|
81
|
+
File.chmod(775, vendor_path) unless File.executable?(vendor_path) # Make sure vendor binary is executable
|
82
|
+
vendor_path
|
83
|
+
end
|
84
|
+
end
|
71
85
|
end
|
72
86
|
end
|
data/lib/youtube-dl/version.rb
CHANGED
data/lib/youtube-dl.rb
CHANGED
File without changes
|
data/test/test_helper.rb
CHANGED
File without changes
|
@@ -18,13 +18,13 @@ describe YoutubeDL::Runner do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should set executable path automatically' do
|
21
|
-
|
21
|
+
assert_match 'youtube-dl', @runner.executable_path
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should parse key-values from options' do
|
25
25
|
@runner.options.some_key = "a value"
|
26
26
|
|
27
|
-
refute_nil @runner.to_command.match(/--some-key\s.*a value.*/)
|
27
|
+
refute_nil @runner.to_command.match(/--some-key\s.*a value.*/)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should not include the value if value is true' do
|
File without changes
|
Binary file
|
Binary file
|
data/youtube-dl.rb.gemspec
CHANGED
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.0.
|
4
|
+
version: 0.0.3
|
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-
|
12
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cocaine
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: codeclimate-test-reporter
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
98
112
|
description: in the spirit of pygments.rb and MiniMagick, youtube-dl.rb is a command
|
99
113
|
line wrapper for the python script youtube-dl
|
100
114
|
email:
|
@@ -117,6 +131,8 @@ files:
|
|
117
131
|
- test/youtube-dl/options_test.rb
|
118
132
|
- test/youtube-dl/runner_test.rb
|
119
133
|
- test/youtube-dl/youtube-dl_test.rb
|
134
|
+
- vendor/bin/youtube-dl
|
135
|
+
- vendor/bin/youtube-dl.exe
|
120
136
|
- youtube-dl.rb.gemspec
|
121
137
|
homepage: https://github.com/layer8x/youtube-dl.rb
|
122
138
|
licenses:
|
@@ -138,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
154
|
version: '0'
|
139
155
|
requirements: []
|
140
156
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.4.8
|
142
158
|
signing_key:
|
143
159
|
specification_version: 4
|
144
160
|
summary: youtube-dl wrapper for Ruby
|