quvi 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +117 -2
- data/ext/quvi_ext/quvi_ext.c +2 -2
- data/lib/quvi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7799db0a8f553674ce22b344391c3110f7bd163b
|
4
|
+
data.tar.gz: fe8160860cef0c0b29499d369d28ed55c04493ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6945f1f216df6367803226a2fdec01d01bd37cad973e20d3594714bb5439420b0c44c72ebf7ef06ce1121f96882132208e59f2419c3768737b2f071cebb4956
|
7
|
+
data.tar.gz: 094dab6020a0e4cc7759209e2ccf233b8d8aaaf789aac30bd1b4f36b5fb3ed1201bc7c5010a25029f5ffd30b73b67bcd7d2897269641451c9135efa79c4d7bc8
|
data/README.markdown
CHANGED
@@ -24,11 +24,126 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
27
|
+
Create an handle which basically encapsulates HTTP session
|
28
|
+
|
29
|
+
handle = Quvi::Handle.new(user_agent: "Chrome/33.0.1712.4")
|
30
|
+
|
31
|
+
Pass an media URL to `Quvi::Handle#parse_media` method (note how it tags the best available stream)
|
32
|
+
|
33
|
+
handle.parse_media("https://www.youtube.com/watch?v=9PLY4TWo7f0")
|
34
|
+
# {:id=>"9PLY4TWo7f0",
|
35
|
+
# :title=>"Big Ruby 2014 - Keynote by Keavy McMinn",
|
36
|
+
# :thumbnail_url=>"https://i1.ytimg.com/vi/9PLY4TWo7f0/default.jpg",
|
37
|
+
# :duration_ms=>1627000,
|
38
|
+
# :streams=>
|
39
|
+
# [{:id=>"hd720_mp4_i22_720p", :best=>true, :video_height=>720, :video_width=>1280, :video_encoding=>"avc1.64001F", :audio_encoding=>"mp4a.40.2", :container=>"mp4", :url=> "http://..."},
|
40
|
+
# {:id=>"medium_mp4_i18_360p", :video_height=>360, :video_width=>640, :video_encoding=>"avc1.42001E", :audio_encoding=>"mp4a.40.2", :container=>"mp4", :url=> "http://..."},
|
41
|
+
# {:id=>"small_flv_i05_240p", :video_height=>240, :video_width=>320, :video_encoding=>"", :audio_encoding=>"", :container=>"flv", :url=> "http://..."},
|
42
|
+
# {:id=>"small_3gpp_i36_240p", :video_height=>240, :video_width=>320, :video_encoding=>"mp4v.20.3", :audio_encoding=>"mp4a.40.2", :container=>"3gpp", :url=> "http://..."},
|
43
|
+
# {:id=>"small_3gpp_i17_144p", :video_height=>144, :video_width=>176, :video_encoding=>"mp4v.20.3", :audio_encoding=>"mp4a.40.2", :container=>"3gpp", :url=> "http://..."}]}
|
44
|
+
|
45
|
+
It can parse playlists too with `Quvi::Handle#parse_playlist`
|
46
|
+
|
47
|
+
handle.parse_playlist("https://www.youtube.com/playlist?list=PLE7tQUdRKcyYqVZi0LIbAsfwv_Jr-rrua")
|
48
|
+
# {:id=>"PLE7tQUdRKcyYqVZi0LIbAsfwv_Jr-rrua",
|
49
|
+
# :title=>"Cascadia Ruby 2013",
|
50
|
+
# :thumbnail_url=>"https://i.ytimg.com/vi/MkoTmq3I4DM/hqdefault.jpg",
|
51
|
+
# :media=>
|
52
|
+
# [{:url=>"https://www.youtube.com/watch?v=MkoTmq3I4DM&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 Coding and The Mozart Effect by PJ Hagerty", :duration_ms=>1775000},
|
53
|
+
# {:url=>"https://www.youtube.com/watch?v=0y2Sok9ikj8&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 Taking Ruby to the Movies by Jeremy Hinegardner", :duration_ms=>1776000},
|
54
|
+
# {:url=>"https://www.youtube.com/watch?v=euDXpKwtCHY&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 Tell Us Another Story Grandpa: Lessons Learned over 16 Years as a Developer", :duration_ms=>1643000},
|
55
|
+
# {:url=>"https://www.youtube.com/watch?v=FsBgpvDnUSk&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 Ruby Robotics by Josh Adams and Robby Clements", :duration_ms=>1378000},
|
56
|
+
# {:url=>"https://www.youtube.com/watch?v=rpeugzat2o4&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 We All Make Mistakes: Learning from Gaffes in the Ruby Community by Nick Cox", :duration_ms=>1868000},
|
57
|
+
# {:url=>"https://www.youtube.com/watch?v=g4LJNZKyqOw&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 We're sorry, but something went wrong by Aja Hammerly", :duration_ms=>1909000},
|
58
|
+
# {:url=>"https://www.youtube.com/watch?v=x9Kazz5-tDo&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 The hacker's guide to usability testing by Starr Horne", :duration_ms=>1487000},
|
59
|
+
# {:url=>"https://www.youtube.com/watch?v=iSug6CgxWxc&feature=youtube_gdata", :title=> "Cascadia Ruby 2013 Sentiment Analysis using Support Vector Machines in Ruby by Matthew Kirk", :duration_ms=>1518000}]}
|
60
|
+
|
61
|
+
Youtube isn't the only site it supports. You can fine full list of them in the [repository](https://github.com/legatvs/libquvi-scripts) or write your own using guides on the [libquvi-scripts site](http://quvi.sourceforge.net/r/dev/contributing/). Also it is quite easy to enumerate all accessible scripts from the ruby:
|
62
|
+
|
63
|
+
handle.each_script do |script|
|
64
|
+
p script
|
65
|
+
end
|
66
|
+
# {:sha1=>"cc2d07c64cb329d9d14209ce464030a2eb152dc6", :filepath=>"/usr/share/libquvi-scripts/0.9/scan/youtube.lua", :type=>"scan"}
|
67
|
+
# {:sha1=>"e145e40e56f27805278ae6a36352bab3225d4d77", :filepath=>"/usr/share/libquvi-scripts/0.9/scan/vzaar.lua", :type=>"scan"}
|
68
|
+
# {:sha1=>"a6e55279aaee3bbe6b372fc55b8a6f7751e34ace", :filepath=>"/usr/share/libquvi-scripts/0.9/playlist/youtube.lua", :type=>"playlist", :domains=>["youtube.com"]}
|
69
|
+
# {:sha1=>"ddc1d5aaa691131d3ef30cf1b9b482d38cacee51", :filepath=>"/usr/share/libquvi-scripts/0.9/playlist/soundcloud.lua", :type=>"playlist", :domains=>["soundcloud.com"]}
|
70
|
+
# {:sha1=>"32e0ead26b603ee10f1deba49e2352d14edd4d67", :filepath=>"/usr/share/libquvi-scripts/0.9/media/audioboo.lua", :type=>"media", :domains=>["audioboo.fm"]}
|
71
|
+
# {:sha1=>"a0879b74362cfba9dcaebc3ffe16d034368ed60c", :filepath=>"/usr/share/libquvi-scripts/0.9/media/liveleak.lua", :type=>"media", :domains=>["liveleak.com"]}
|
72
|
+
# {:sha1=>"a1427a3a019877eafa5f5f5960d086c609ab8d1f", :filepath=>"/usr/share/libquvi-scripts/0.9/media/bikeradar.lua", :type=>"media", :domains=>["bikeradar.com"]}
|
73
|
+
# {:sha1=>"7fd0a857cf904d1547c119444e2ce29297accec1", :filepath=>"/usr/share/libquvi-scripts/0.9/media/sapo.lua", :type=>"media", :domains=>["videos.sapo.pt"]}
|
74
|
+
# {:sha1=>"b935fbe2881e0869028741f630fb7471413aeffe", :filepath=>"/usr/share/libquvi-scripts/0.9/media/sevenload.lua", :type=>"media", :domains=>["sevenload.com"]}
|
75
|
+
# {:sha1=>"60a7e893e8aa5f71ed1cc5e4a4fb4f89992f85e5", :filepath=>"/usr/share/libquvi-scripts/0.9/media/ina.lua", :type=>"media", :domains=>["ina.fr"]}
|
76
|
+
# {:sha1=>"452aa94dc655090d6c30929335bf5ad73d29e92f", :filepath=>"/usr/share/libquvi-scripts/0.9/media/metacafe.lua", :type=>"media", :domains=>["metacafe.com"]}
|
77
|
+
# {:sha1=>"2db42ea01ff5700210e814806712c4892a61bda0", :filepath=>"/usr/share/libquvi-scripts/0.9/media/dailymotion.lua", :type=>"media", :domains=>["dailymotion.com"]}
|
78
|
+
# {:sha1=>"cfed259fa8f679ca5ac49f6d34144128df716939", :filepath=>"/usr/share/libquvi-scripts/0.9/media/ardmediathek.lua", :type=>"media", :domains=>["ardmediathek.de"]}
|
79
|
+
# {:sha1=>"e1ba6e629a11518c3548c69f3723118a7ac1062d", :filepath=>"/usr/share/libquvi-scripts/0.9/media/clipfish.lua", :type=>"media", :domains=>["clipfish.de"]}
|
80
|
+
# {:sha1=>"1853a56b0bd5a18d47f967e875b55c6aa3a7dbb7", :filepath=>"/usr/share/libquvi-scripts/0.9/media/101greatgoals.lua", :type=>"media", :domains=>["101greatgoals.com"]}
|
81
|
+
# {:sha1=>"363c01107cd71f360c3f8723ecef7bfba2ab3d73", :filepath=>"/usr/share/libquvi-scripts/0.9/media/gaskrank.lua", :type=>"media", :domains=>["gaskrank.tv"]}
|
82
|
+
# {:sha1=>"911433da47662580548e93f0529babcce0863853", :filepath=>"/usr/share/libquvi-scripts/0.9/media/theonion.lua", :type=>"media", :domains=>["theonion.com"]}
|
83
|
+
# {:sha1=>"0ae3b44c7b01ae3c7e2e7f4a16cd0dcec79f567a", :filepath=>"/usr/share/libquvi-scripts/0.9/media/youtube.lua", :type=>"media", :domains=>["youtube.com"]}
|
84
|
+
# {:sha1=>"69974caa7b3fcdb74b6bd791a6edb610b3dfe4ee", :filepath=>"/usr/share/libquvi-scripts/0.9/media/majestyc.lua", :type=>"media", :domains=>["tube.majestyc.net"]}
|
85
|
+
# {:sha1=>"a785a669d1bd2c1c253b64fb1f20937e26ef3609", :filepath=>"/usr/share/libquvi-scripts/0.9/media/videobash.lua", :type=>"media", :domains=>["videobash.com"]}
|
86
|
+
# {:sha1=>"c3c0e34cb0191570be0ba4cd1499fd2afa44f165", :filepath=>"/usr/share/libquvi-scripts/0.9/media/vzaar.lua", :type=>"media", :domains=>["vzaar.com"]}
|
87
|
+
# {:sha1=>"74a632c1a25807b5b094a1c90d614ec865af482d", :filepath=>"/usr/share/libquvi-scripts/0.9/media/spiegel.lua", :type=>"media", :domains=>["spiegel.de"]}
|
88
|
+
# {:sha1=>"3720f0611d54ccd665d13603896de9aa903f72f0", :filepath=>"/usr/share/libquvi-scripts/0.9/media/videa.lua", :type=>"media", :domains=>["videa.hu"]}
|
89
|
+
# {:sha1=>"d9268d6b51da1bb23932e79c5bb4a1a15c3588c4", :filepath=>"/usr/share/libquvi-scripts/0.9/media/ted.lua", :type=>"media", :domains=>["ted.com"]}
|
90
|
+
# {:sha1=>"7aebe106d954b9317f5f7b4a365dacc50933610a", :filepath=>"/usr/share/libquvi-scripts/0.9/media/soundcloud.lua", :type=>"media", :domains=>["soundcloud.com"]}
|
91
|
+
# {:sha1=>"a88735d1e0cc3d61ce45af300008ad97f49b85d3", :filepath=>"/usr/share/libquvi-scripts/0.9/media/tvlux.lua", :type=>"media", :domains=>["tvlux.be"]}
|
92
|
+
# {:sha1=>"419af1632ffd971505f61bc8d04945a271bb45d6", :filepath=>"/usr/share/libquvi-scripts/0.9/media/1tvru.lua", :type=>"media", :domains=>["1tv.ru"]}
|
93
|
+
# {:sha1=>"d3a8db790e9f4e2b55bd0cf88543d8d38e873d4a", :filepath=>"/usr/share/libquvi-scripts/0.9/media/arte.lua", :type=>"media", :domains=>["arte.tv"]}
|
94
|
+
# {:sha1=>"73bcf38c7cb2927a0b8adf29a7b750bc4b21a733", :filepath=>"/usr/share/libquvi-scripts/0.9/media/funnyordie.lua", :type=>"media", :domains=>["funnyordie.com"]}
|
95
|
+
# {:sha1=>"c027be9b93e362e451ad54adef2d14c6d4e458af", :filepath=>"/usr/share/libquvi-scripts/0.9/media/tapuz.lua", :type=>"media", :domains=>["flix.tapuz.co.il"]}
|
96
|
+
# {:sha1=>"3505d6777a8e03ea3bcf01cf113e2c8c9eeec1fd", :filepath=>"/usr/share/libquvi-scripts/0.9/media/cbsnews.lua", :type=>"media", :domains=>["cbsnews.com"]}
|
97
|
+
# {:sha1=>"780399daec55e457c766cde986b35884c79a2e52", :filepath=>"/usr/share/libquvi-scripts/0.9/media/guardian.lua", :type=>"media", :domains=>["theguardian.com", "guardian.co.uk"]}
|
98
|
+
# {:sha1=>"a82c60a96067232b3b8cdcd864e16e9509fe947d", :filepath=>"/usr/share/libquvi-scripts/0.9/media/tagtele.lua", :type=>"media", :domains=>["tagtele.com"]}
|
99
|
+
# {:sha1=>"1d353ae17cf6d7df597fefbfd81cf8c85e282b7d", :filepath=>"/usr/share/libquvi-scripts/0.9/media/publicsenat.lua", :type=>"media", :domains=>["publicsenat.fr"]}
|
100
|
+
# {:sha1=>"46000b58b080b4cb8500634087d19ea54dadab63", :filepath=>"/usr/share/libquvi-scripts/0.9/media/lego.lua", :type=>"media", :domains=>["lego.com"]}
|
101
|
+
# {:sha1=>"69ee55e3e10c73700c06695055363a6f8a064e5d", :filepath=>"/usr/share/libquvi-scripts/0.9/media/senat.lua", :type=>"media", :domains=>["videos.senat.fr"]}
|
102
|
+
# {:sha1=>"c286f739d77da6e1245ab415be7016cf5fad7e0b", :filepath=>"/usr/share/libquvi-scripts/0.9/media/myspass.lua", :type=>"media", :domains=>["myspass.de"]}
|
103
|
+
# {:sha1=>"ea16f366f98582d0d52af56cbd3dbe847930dfc3", :filepath=>"/usr/share/libquvi-scripts/0.9/subtitle/youtube.lua", :type=>"subtitle", :domains=>["youtube.com"]}
|
104
|
+
# {:sha1=>"7411739ec618bbf3486d98cc0fd64962cfee1239", :filepath=>"/usr/share/libquvi-scripts/0.9/subtitle/export/subrip.lua", :type=>"subtitle_export", :export_format=>"srt"}
|
105
|
+
|
106
|
+
To check if particular URL supported by the library, you can use
|
107
|
+
`Quvi::Handle#supports?` like this:
|
108
|
+
|
109
|
+
require 'quvi'
|
110
|
+
handle = Quvi::Handle.new
|
111
|
+
handle.supports?("https://soundcloud.com/meta-ex/burning-the-moroder-lamp")
|
112
|
+
# => false
|
113
|
+
handle.supports?("https://soundcloud.com/meta-ex/burning-the-moroder-lamp", online: true)
|
114
|
+
# => true
|
115
|
+
handle.supports?("https://www.youtube.com/watch?v=S6-L4xws9l0", type: :playlist)
|
116
|
+
# => false
|
117
|
+
handle.supports?("https://www.youtube.com/watch?v=S6-L4xws9l0", type: :media)
|
118
|
+
# => true
|
119
|
+
handle.supports?("https://www.youtube.com/watch?v=S6-L4xws9l0", type: :any)
|
120
|
+
# => true
|
121
|
+
|
122
|
+
There are also couple of handy methods defined on `Quvi` module, to
|
123
|
+
simplify argument parsing. First `Quvi.parse_multiple` accepts array
|
124
|
+
of URLs, dynamically detects type and parse each of them using simple
|
125
|
+
thread pool. As far as most of the Quvi work is IO, ruby VM can
|
126
|
+
perfectly optimize it.
|
127
|
+
|
128
|
+
|
129
|
+
## Issues
|
130
|
+
|
131
|
+
Please use [github issues](https://github.com/avsej/quvi.rb/issues) to
|
132
|
+
report any bugs or ideas. Also do not forget to include the version of
|
133
|
+
the library into report:
|
134
|
+
|
135
|
+
$ ruby -rpp -rrubygems -rquvi -e'pp Quvi::VERSION.to_h'
|
136
|
+
{:version=>"0.1.0",
|
137
|
+
:quvi_version=>"v0.9.2",
|
138
|
+
:quvi_configuration=> "--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-static=no --disable-rpath",
|
139
|
+
:quvi_build_cc_cflags=> "gcc, -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic",
|
140
|
+
:quvi_build_target=>"x86_64-redhat-linux-gnu",
|
141
|
+
:quvi_build_time=>"2013-08-27 04:11:40 +0000"}
|
142
|
+
|
28
143
|
|
29
144
|
## Contributing
|
30
145
|
|
31
|
-
1. Fork it (
|
146
|
+
1. Fork it ([http://github.com/avsej/quvi.rb/fork](http://github.com/avsej/quvi.rb/fork))
|
32
147
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
148
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
149
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/ext/quvi_ext/quvi_ext.c
CHANGED
@@ -237,12 +237,12 @@ VALUE qv_handle_each_script(VALUE self)
|
|
237
237
|
#define set_property(key, id) \
|
238
238
|
s = NULL; \
|
239
239
|
quvi_script_get(handle->q, types[i], id, &s); \
|
240
|
-
if (s) { rb_hash_aset(script, key, rb_external_str_new_cstr(s)); }
|
240
|
+
if (s && s[0] != '\0') { rb_hash_aset(script, key, rb_external_str_new_cstr(s)); }
|
241
241
|
set_property(qv_sym_sha1, QUVI_SCRIPT_PROPERTY_SHA1);
|
242
242
|
set_property(qv_sym_filepath, QUVI_SCRIPT_PROPERTY_FILEPATH);
|
243
243
|
rb_hash_aset(script, qv_sym_type, type_names[i]);
|
244
244
|
quvi_script_get(handle->q, types[i], QUVI_SCRIPT_PROPERTY_DOMAINS, &s);
|
245
|
-
if (
|
245
|
+
if (s && s[0] != '\0') {
|
246
246
|
VALUE domains = rb_external_str_new_cstr(s);
|
247
247
|
rb_hash_aset(script, qv_sym_domains, rb_str_split(domains, ","));
|
248
248
|
}
|
data/lib/quvi/version.rb
CHANGED