youtube_search 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +2 -2
- data/Gemfile +4 -5
- data/Gemfile.lock +14 -12
- data/Rakefile +1 -14
- data/Readme.md +1 -0
- data/lib/youtube_search.rb +7 -3
- data/lib/youtube_search/version.rb +1 -1
- data/spec/fixtures/playlist_5F23DAF4BFE3D14C.json +122 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/youtube_search_spec.rb +7 -0
- metadata +9 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d405bad41204bd5c4d7fcb56088c49f2a2ac77c
|
4
|
+
data.tar.gz: 317b727de0726b687bdedbd14d3825f7e16563da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5730da647343599f349413f3711454362a3c118824dbb29e349333ea5124e19b5b3fa4ac75a33d17a263dfd6c4a79a025f830d0168d070bfb8ae3c31db585a73
|
7
|
+
data.tar.gz: b1d9eb9d4f98ab68cec1bb38d956974c29fc33b391c5102ca8e02910f59e667c7f44fa8d001dba5749f62cf5408d3403467dac12810669405341351e2378e116
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
youtube_search (0.1.
|
4
|
+
youtube_search (0.1.8)
|
5
5
|
|
6
6
|
GEM
|
7
|
-
remote:
|
7
|
+
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
rspec-
|
14
|
-
rspec-
|
15
|
-
|
16
|
-
rspec-
|
17
|
-
|
18
|
-
|
9
|
+
bump (0.5.0)
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
rake (10.3.2)
|
12
|
+
rspec (2.99.0)
|
13
|
+
rspec-core (~> 2.99.0)
|
14
|
+
rspec-expectations (~> 2.99.0)
|
15
|
+
rspec-mocks (~> 2.99.0)
|
16
|
+
rspec-core (2.99.0)
|
17
|
+
rspec-expectations (2.99.0)
|
18
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
19
|
+
rspec-mocks (2.99.1)
|
19
20
|
|
20
21
|
PLATFORMS
|
21
22
|
ruby
|
22
23
|
|
23
24
|
DEPENDENCIES
|
25
|
+
bump
|
24
26
|
rake
|
25
27
|
rspec (~> 2)
|
26
28
|
youtube_search!
|
data/Rakefile
CHANGED
@@ -1,24 +1,11 @@
|
|
1
1
|
require "bundler/setup"
|
2
2
|
require "bundler/gem_tasks"
|
3
|
+
require "bump/tasks"
|
3
4
|
|
4
5
|
task :default do
|
5
6
|
sh "rspec spec/"
|
6
7
|
end
|
7
8
|
|
8
|
-
rule /^version:bump:.*/ do |t|
|
9
|
-
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
|
10
|
-
index = ['major', 'minor','patch'].index(t.name.split(':').last)
|
11
|
-
file = 'lib/youtube_search/version.rb'
|
12
|
-
|
13
|
-
version_file = File.read(file)
|
14
|
-
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
|
15
|
-
version_parts[index] = version_parts[index].to_i + 1
|
16
|
-
new_version = version_parts * '.'
|
17
|
-
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
|
18
|
-
|
19
|
-
sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
|
20
|
-
end
|
21
|
-
|
22
9
|
desc "Update fixtures by downloading them"
|
23
10
|
task :update_fixtures do
|
24
11
|
require 'youtube_search'
|
data/Readme.md
CHANGED
@@ -59,6 +59,7 @@ Author
|
|
59
59
|
### [Contributors](http://github.com/grosser/youtube_search/contributors)
|
60
60
|
- [David Gil](https://qoolife.com)
|
61
61
|
- [Jim Jones](https://github.com/aantix)
|
62
|
+
- [Sławek](https://github.com/sbogutyn)
|
62
63
|
|
63
64
|
[Michael Grosser](http://grosser.it)<br/>
|
64
65
|
michael@grosser.it<br/>
|
data/lib/youtube_search.rb
CHANGED
@@ -19,10 +19,14 @@ module YoutubeSearch
|
|
19
19
|
search_page("https://gdata.youtube.com/feeds/api/playlists/snippets", query, options.merge(:v => 2))
|
20
20
|
end
|
21
21
|
|
22
|
-
def playlist_videos(playlist_id)
|
22
|
+
def playlist_videos(playlist_id, options={})
|
23
23
|
playlist_id = playlist_id.sub(/^PL/, "")
|
24
|
-
|
25
|
-
|
24
|
+
res = open("http://gdata.youtube.com/feeds/api/playlists/#{playlist_id}?v=2#{'&alt=json' if options[:format] == :json}").read
|
25
|
+
if options[:format] == :json
|
26
|
+
res
|
27
|
+
else
|
28
|
+
parse(res, :type => :playlist)
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
def parse(xml, options={})
|
@@ -0,0 +1,122 @@
|
|
1
|
+
[{"id"=>
|
2
|
+
"tag:youtube.com,2008:playlist:5F23DAF4BFE3D14C:PLkRk0fUfl9UJvHjGFHgPSakUFmztBgGKG",
|
3
|
+
"published"=>"2011-11-30T13:55:52.000Z",
|
4
|
+
"updated"=>"1970-01-01T00:00:00.000Z",
|
5
|
+
"category"=>nil,
|
6
|
+
"title"=>"Osteopatia y terapias manuales",
|
7
|
+
"content"=>nil,
|
8
|
+
"link"=>nil,
|
9
|
+
"author"=>nil,
|
10
|
+
"accessControl"=>nil,
|
11
|
+
"comments"=>nil,
|
12
|
+
"where"=>nil,
|
13
|
+
"group"=>nil,
|
14
|
+
"rating"=>nil,
|
15
|
+
"recorded"=>"2010-01-08",
|
16
|
+
"statistics"=>nil,
|
17
|
+
"position"=>"1",
|
18
|
+
"video_id"=>"5wU-yHnq7Hs",
|
19
|
+
"duration"=>"192",
|
20
|
+
"embeddable"=>true,
|
21
|
+
"raw"=>''},
|
22
|
+
{"id"=>
|
23
|
+
"tag:youtube.com,2008:playlist:5F23DAF4BFE3D14C:PLkRk0fUfl9UKdlAKbbMWlfjo9ojnLihjF",
|
24
|
+
"published"=>"2011-11-30T13:55:52.000Z",
|
25
|
+
"updated"=>"1970-01-01T00:00:00.000Z",
|
26
|
+
"category"=>nil,
|
27
|
+
"title"=>"Rizartrosis y Tendinitis de Quervain.m4v",
|
28
|
+
"content"=>nil,
|
29
|
+
"link"=>nil,
|
30
|
+
"author"=>nil,
|
31
|
+
"accessControl"=>nil,
|
32
|
+
"comments"=>nil,
|
33
|
+
"where"=>nil,
|
34
|
+
"group"=>nil,
|
35
|
+
"rating"=>nil,
|
36
|
+
"recorded"=>"2010-06-21",
|
37
|
+
"statistics"=>nil,
|
38
|
+
"position"=>"2",
|
39
|
+
"video_id"=>"QC1GLNiPtSY",
|
40
|
+
"duration"=>"92",
|
41
|
+
"embeddable"=>true,
|
42
|
+
"raw"=>''},
|
43
|
+
{"id"=>
|
44
|
+
"tag:youtube.com,2008:playlist:5F23DAF4BFE3D14C:PLkRk0fUfl9UKKop_MiyjnvNikUPNEYsZ2",
|
45
|
+
"published"=>"2011-11-30T13:55:52.000Z",
|
46
|
+
"updated"=>"1970-01-01T00:00:00.000Z",
|
47
|
+
"category"=>nil,
|
48
|
+
"title"=>"Sesamoiditis y tendinitis del primer metatarsiano 1",
|
49
|
+
"content"=>nil,
|
50
|
+
"link"=>nil,
|
51
|
+
"author"=>nil,
|
52
|
+
"accessControl"=>nil,
|
53
|
+
"comments"=>nil,
|
54
|
+
"location"=>"Avenica camino de santiago 31 madrid",
|
55
|
+
"group"=>nil,
|
56
|
+
"rating"=>nil,
|
57
|
+
"recorded"=>"2010-03-03",
|
58
|
+
"statistics"=>nil,
|
59
|
+
"position"=>"3",
|
60
|
+
"video_id"=>"GObLbr3pQag",
|
61
|
+
"duration"=>"120",
|
62
|
+
"embeddable"=>true,
|
63
|
+
"raw"=>''},
|
64
|
+
{"id"=>
|
65
|
+
"tag:youtube.com,2008:playlist:5F23DAF4BFE3D14C:PLkRk0fUfl9UL7bE4uNUuJI9zDGcm3a5lc",
|
66
|
+
"published"=>"2011-11-30T13:55:52.000Z",
|
67
|
+
"updated"=>"1970-01-01T00:00:00.000Z",
|
68
|
+
"category"=>nil,
|
69
|
+
"title"=>"Drenaje linfático gestacional",
|
70
|
+
"content"=>nil,
|
71
|
+
"link"=>nil,
|
72
|
+
"author"=>nil,
|
73
|
+
"accessControl"=>nil,
|
74
|
+
"comments"=>nil,
|
75
|
+
"where"=>nil,
|
76
|
+
"group"=>nil,
|
77
|
+
"rating"=>nil,
|
78
|
+
"recorded"=>"2010-01-08",
|
79
|
+
"statistics"=>nil,
|
80
|
+
"position"=>"4",
|
81
|
+
"video_id"=>"SDurBqiV4kk",
|
82
|
+
"duration"=>"130",
|
83
|
+
"embeddable"=>true,
|
84
|
+
"raw"=>''},
|
85
|
+
{"id"=>
|
86
|
+
"tag:youtube.com,2008:playlist:5F23DAF4BFE3D14C:PLkRk0fUfl9UK9Qb2pwCziSRuXJdMWvKzp",
|
87
|
+
"published"=>"2011-11-30T13:55:52.000Z",
|
88
|
+
"updated"=>"1970-01-01T00:00:00.000Z",
|
89
|
+
"category"=>nil,
|
90
|
+
"title"=>
|
91
|
+
"Clínica VASS en Las Mañanas de la 1 - Tratamiento de estreñimiento infantil y de adultos.wmv",
|
92
|
+
"content"=>nil,
|
93
|
+
"link"=>nil,
|
94
|
+
"author"=>nil,
|
95
|
+
"accessControl"=>nil,
|
96
|
+
"comments"=>nil,
|
97
|
+
"group"=>nil,
|
98
|
+
"rating"=>nil,
|
99
|
+
"statistics"=>nil,
|
100
|
+
"position"=>"5",
|
101
|
+
"video_id"=>"FcTOgyk8hdk",
|
102
|
+
"duration"=>"207",
|
103
|
+
"embeddable"=>true,
|
104
|
+
"raw"=>''},
|
105
|
+
{"id"=>
|
106
|
+
"tag:youtube.com,2008:playlist:5F23DAF4BFE3D14C:PLkRk0fUfl9UJjAJ_IhEXk66NLSWsf8ORa",
|
107
|
+
"published"=>"2011-11-30T13:55:52.000Z",
|
108
|
+
"updated"=>"1970-01-01T00:00:00.000Z",
|
109
|
+
"category"=>nil,
|
110
|
+
"title"=>"Clínica VASS en TVE - Las mañanas de la 1",
|
111
|
+
"content"=>nil,
|
112
|
+
"link"=>nil,
|
113
|
+
"author"=>nil,
|
114
|
+
"accessControl"=>nil,
|
115
|
+
"comments"=>nil,
|
116
|
+
"group"=>nil,
|
117
|
+
"statistics"=>nil,
|
118
|
+
"position"=>"6",
|
119
|
+
"video_id"=>"QqepLC4z4lk",
|
120
|
+
"duration"=>"189",
|
121
|
+
"embeddable"=>true,
|
122
|
+
"raw"=>''}]
|
data/spec/spec_helper.rb
CHANGED
data/spec/youtube_search_spec.rb
CHANGED
@@ -105,6 +105,13 @@ describe YoutubeSearch do
|
|
105
105
|
YoutubeSearch.playlist_videos(id).size.should == 6
|
106
106
|
id.should == 'PL5F23DAF4BFE3D14C'
|
107
107
|
end
|
108
|
+
|
109
|
+
it "can retrieve videos from a playlist in json format" do
|
110
|
+
videos = JSON.parse(
|
111
|
+
YoutubeSearch.playlist_videos('5F23DAF4BFE3D14C', :format => :json)
|
112
|
+
)['feed']['entry']
|
113
|
+
videos.size.should == 6
|
114
|
+
end
|
108
115
|
end
|
109
116
|
|
110
117
|
describe 'options_with_per_page_and_page' do
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youtube_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Grosser
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description:
|
15
14
|
email: michael@grosser.it
|
@@ -17,13 +16,14 @@ executables: []
|
|
17
16
|
extensions: []
|
18
17
|
extra_rdoc_files: []
|
19
18
|
files:
|
20
|
-
- .travis.yml
|
19
|
+
- ".travis.yml"
|
21
20
|
- Gemfile
|
22
21
|
- Gemfile.lock
|
23
22
|
- Rakefile
|
24
23
|
- Readme.md
|
25
24
|
- lib/youtube_search.rb
|
26
25
|
- lib/youtube_search/version.rb
|
26
|
+
- spec/fixtures/playlist_5F23DAF4BFE3D14C.json
|
27
27
|
- spec/fixtures/playlist_5F23DAF4BFE3D14C.xml
|
28
28
|
- spec/fixtures/playlist_search_google_developers.xml
|
29
29
|
- spec/fixtures/search_boat.xml
|
@@ -32,32 +32,25 @@ files:
|
|
32
32
|
- youtube_search.gemspec
|
33
33
|
homepage: http://github.com/grosser/youtube_search
|
34
34
|
licenses: []
|
35
|
+
metadata: {}
|
35
36
|
post_install_message:
|
36
37
|
rdoc_options: []
|
37
38
|
require_paths:
|
38
39
|
- lib
|
39
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
41
|
requirements:
|
42
|
-
- -
|
42
|
+
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
hash: 3459774421514102867
|
48
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
46
|
requirements:
|
51
|
-
- -
|
47
|
+
- - ">="
|
52
48
|
- !ruby/object:Gem::Version
|
53
49
|
version: '0'
|
54
|
-
segments:
|
55
|
-
- 0
|
56
|
-
hash: 3459774421514102867
|
57
50
|
requirements: []
|
58
51
|
rubyforge_project:
|
59
|
-
rubygems_version:
|
52
|
+
rubygems_version: 2.2.2
|
60
53
|
signing_key:
|
61
|
-
specification_version:
|
54
|
+
specification_version: 4
|
62
55
|
summary: Search youtube via this simple ruby api
|
63
56
|
test_files: []
|