video-dl 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/video-dl +57 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aa500ccd48ac4dd53b0f533d9152a2568bea2ea7
|
4
|
+
data.tar.gz: acebbe336a0b629330a88c3dc9da4c6db8f8672a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 408e28e321bcdb2d6ea7532b2e2e9fe2ed82c072722444e7657e73e6b38738433b061247e2df640af6b3b8c109ef00a11b2107641c652c735b418cac7401b4c2
|
7
|
+
data.tar.gz: ee75592ed19318366d46dbfacb93ade891344640fe0d2a34203773edfe9a02e3f91d4e5500e4375818d242cc97ad3ef12ae24da556992d4a3f8ba47bb48f105b
|
data/bin/video-dl
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require "bundler/setup"
|
5
|
+
require 'commander/import'
|
6
|
+
require 'json'
|
7
|
+
require 'open-uri'
|
8
|
+
require 'nokogiri'
|
9
|
+
|
10
|
+
program :name, "video-dl"
|
11
|
+
program :version, '1.0.0'
|
12
|
+
program :description, 'Download video easily'
|
13
|
+
|
14
|
+
default_command :download
|
15
|
+
|
16
|
+
command :download do |c|
|
17
|
+
c.syntax = 'video-dl download http://some.url'
|
18
|
+
c.description = 'Download a video'
|
19
|
+
c.option '--bar STRING', String, 'Option bar with a string'
|
20
|
+
c.action do |args, options|
|
21
|
+
options.default :bar => 'BAR'
|
22
|
+
# puts "Args: #{args}"
|
23
|
+
# puts "Option Bar: #{options.bar}"
|
24
|
+
url = args[0]
|
25
|
+
download_video(url)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
########################################################################################
|
33
|
+
# Video Download
|
34
|
+
########################################################################################
|
35
|
+
|
36
|
+
def download_video(url)
|
37
|
+
puts "Downloading #{url}"
|
38
|
+
|
39
|
+
doc = Nokogiri::HTML(open(url))
|
40
|
+
# puts doc
|
41
|
+
|
42
|
+
title = doc.css("h1[class='title']")[0].content
|
43
|
+
puts "Title: #{title}"
|
44
|
+
|
45
|
+
iframeSrc = doc.css('div#servermobile > iframe')[0]['src']
|
46
|
+
# puts iframeSrc
|
47
|
+
|
48
|
+
doc = Nokogiri::HTML(open(iframeSrc))
|
49
|
+
# puts doc
|
50
|
+
|
51
|
+
videoUrl = doc.css("video#my-video > source[label='720']")[0]['src']
|
52
|
+
puts "Video is at #{videoUrl} \n\n"
|
53
|
+
|
54
|
+
cmd = "youtube-dl -o #{Shellwords.escape(title)}.mp4 #{Shellwords.escape(videoUrl)}"
|
55
|
+
puts "Running #{cmd}"
|
56
|
+
puts system(cmd)
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: video-dl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Junda
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: commander
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Download video from various sources
|
28
|
+
email: junda@just2us.com
|
29
|
+
executables:
|
30
|
+
- video-dl
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- bin/video-dl
|
35
|
+
homepage:
|
36
|
+
licenses: []
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 2.4.8
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Download video
|
58
|
+
test_files: []
|