rget 2.0.0 → 2.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3948e94aa1e3af6de50e3932f601b9cca3d7f9bd
4
- data.tar.gz: e81647ae6ecd6a38f29a8da45672108d0d4f2a29
3
+ metadata.gz: 9bbcdd295bd2264f6956c5ec29bc69936b3e1219
4
+ data.tar.gz: 723353449908d108711640f531098eeb6777ea6b
5
5
  SHA512:
6
- metadata.gz: 831e83211408af8a52f7731a3bdaf3cfe33f3116d3ca525774d924df9d761a09f5f1181d9e79208d9a489b6b394088c916b805bcb1b156ffe4bba013a33e364b
7
- data.tar.gz: be3ebe369368e0e73473b78a8791ae8bba96b1799b2224196687a013b388a1c0d7f32dff35e4c9ef8bd16b89a198bbe4960aef4f11b8fe2012d6c1819357e071
6
+ metadata.gz: 529dea3909e06650a821dca237d6591e7849f5542c741e268952f50c463cdcf3e1e1423bfda6218708975691bae415537bd7d99816d8a5a44d7eedd76cbe1b97
7
+ data.tar.gz: 79ffe2a9dbc7c295cf269a7e67f7c5dd720e419b3eee152912304d5054333e639956bc105bb5f6a74e0164b5c62dbdb786d507790c0ed32a131b0d416693f81b
@@ -23,6 +23,9 @@ class WebRadio
23
23
  when %r[nicovideo\.jp]
24
24
  require 'nicovideo'
25
25
  Nicovideo.new(url, options)
26
+ when %r[www\.youtube\.com]
27
+ require 'youtube'
28
+ YouTube.new(url, options)
26
29
  else
27
30
  raise 'unsupported url.'
28
31
  end
@@ -64,6 +67,7 @@ private
64
67
  result = Open3.capture3("ffmpeg -i #{src} -ab 64k #{dst}")
65
68
  if result[2].to_i == 0
66
69
  File.delete(src) if delete_src
70
+ puts "done."
67
71
  else
68
72
  puts "failed."
69
73
  $stderr.puts MediaConvertError.new(result[1])
@@ -0,0 +1,27 @@
1
+ require 'webradio'
2
+ require 'open-uri'
3
+ require 'nokogiri'
4
+
5
+ class YouTube < WebRadio
6
+ def download(name)
7
+ list = {}
8
+ playlist = Nokogiri(open(@url, &:read))
9
+ playlist.css('#pl-video-list tr').each do |tr|
10
+ title = tr.attr('data-title')
11
+ serial = title.scan(/(?:[#第]| EP)(\d+)|/).flatten.compact[0].to_i
12
+ video_url = tr.css('a').attr('href').to_s
13
+ list[serial] = video_url
14
+ end
15
+ serial = list.keys.sort.last
16
+ @src = "#{name}##{'%02d' % serial}.mp4"
17
+ @dst = "#{name}##{'%02d' % serial}.mp3"
18
+ mp3ize(@src, @dst) do
19
+ player_url = "http://www.youtube.com#{list[serial]}"
20
+ result = Open3.capture3("viddl-rb -u -q '*:*:mp4' '#{player_url}'")
21
+ video_url = result[0].split.last.chomp
22
+ open(@src, 'wb:ASCII-8BIT') do |o|
23
+ o.write open(video_url, 'r:ASCII-8BIT', &:read)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -4,10 +4,10 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rget"
7
- spec.version = "2.0.0"
7
+ spec.version = "2.1.0"
8
8
  spec.authors = ["TADA Tadashi"]
9
9
  spec.email = ["t@tdtds.jp"]
10
- spec.description = %q{Downloading newest radio programs on the web. Supported radio stations are hibiki, animate, onsen, seaside communications and niconico.}
10
+ spec.description = %q{Downloading newest radio programs on the web. Supported radio stations are hibiki, animate, onsen, seaside communications, niconico and youtube.}
11
11
  spec.summary = %q{Downloading newest radio programs on the web.}
12
12
  spec.homepage = "https://bitbucket.org/tdtds/rget"
13
13
  spec.license = "GPL"
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_runtime_dependency "thor"
21
21
  spec.add_runtime_dependency "nokogiri"
22
22
  spec.add_runtime_dependency "niconico", ">= 1.7.0"
23
+ spec.add_runtime_dependency "viddl-rb"
23
24
  spec.add_runtime_dependency "pit"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.3"
data/rget.yaml CHANGED
@@ -60,3 +60,7 @@ programs:
60
60
  desc: 一番くじ&クレーンキングスペシャル〜響チャレンジ!
61
61
  url: http://ch.nicovideo.jp/search/IDOLM@STER?channel_id=ch346&mode=s&sort=f&order=d&type=video
62
62
  label: 響チャレンジ
63
+ greenight:
64
+ desc: 花澤香菜と雨宮天のRADIO GREE NIGHT
65
+ url: https://www.youtube.com/playlist?list=PLpAhJfIVc-EcAQXGGRlOir7ctL-wNCnoq
66
+ label: GREENIGHT
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rget
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TADA Tadashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: viddl-rb
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: pit
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +123,7 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  description: Downloading newest radio programs on the web. Supported radio stations
112
- are hibiki, animate, onsen, seaside communications and niconico.
126
+ are hibiki, animate, onsen, seaside communications, niconico and youtube.
113
127
  email:
114
128
  - t@tdtds.jp
115
129
  executables:
@@ -131,6 +145,7 @@ files:
131
145
  - lib/seaside-c.rb
132
146
  - lib/uliza.rb
133
147
  - lib/webradio.rb
148
+ - lib/youtube.rb
134
149
  - rget.gemspec
135
150
  - rget.yaml
136
151
  homepage: https://bitbucket.org/tdtds/rget