youtube_search 0.1.10 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2e50c3aad4aa406eb53bd4264f08f39fd670100
4
- data.tar.gz: 7c273e791ee1d5c1d7caff0932c5cea03f60a5cb
3
+ metadata.gz: 266669dd4650672bbde5a8cc03beef88cb468ee2
4
+ data.tar.gz: 3e0ce800af3f97981994c602f9338aa9bf9c3c56
5
5
  SHA512:
6
- metadata.gz: 0b996485a098b434ce9328cc4879dfff152b6a94bc187e9a37b7f9d39b8f6ff0d5ebd50ff47e46b8a6d2d9b15d3de5ba2f5cf96a69237a8b6645aeeda4f5e948
7
- data.tar.gz: abfd8b73538be534ce3cf5fb9261145a681888aae50e4fedf73a4ebf251b1315e832a4289e68fb5ed9c7438dc29db9e9b0fdfa8c04c7ecb77b0c8e2a90ff0047
6
+ metadata.gz: 751f99e2daee0117bad2c7ace0e66602cc2c2b466e565bf0308edb5220e74a2e986088d5a19531ce6cbe1df3fffa8abca128389b87d49bfae5194c66449762c3
7
+ data.tar.gz: b455f974f01dc23d0d0f1324c089fcb35f3310e94267f0aff257f3c08ead4da308af691bfdec4db2f488acd73f7fb0fdb5d5afdf4acfa535521f584b90463e1b
@@ -31,8 +31,15 @@ module YoutubeSearch
31
31
  videos "#{API_URL}/users/#{channel_id}/uploads?v=2", options[:format]
32
32
  end
33
33
 
34
+ def single(video_id, options={})
35
+ options = options.merge(:key => 'entry')
36
+ videos "#{API_URL}/videos/#{video_id}", :xml, options
37
+ end
38
+
34
39
  def parse(xml, options={})
35
- elements_in(xml, 'feed/entry').map do |element|
40
+ key = options[:key] || 'feed/entry'
41
+
42
+ elements_in(xml, key).map do |element|
36
43
  entry = xml_to_hash(element)
37
44
  entry['video_id'] = if options[:type] == :playlist
38
45
  element.elements['*/yt:videoid'].text
@@ -54,13 +61,13 @@ module YoutubeSearch
54
61
 
55
62
  private
56
63
 
57
- def videos(url, format)
64
+ def videos(url, format, options = {})
58
65
  url += '&alt=json' if format == :json
59
66
  res = open(url).read
60
67
  if format == :json
61
68
  res
62
69
  else
63
- parse res
70
+ parse res, options
64
71
  end
65
72
  end
66
73
 
@@ -1,3 +1,3 @@
1
1
  module YoutubeSearch
2
- VERSION = '0.1.10'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it