youtube-g 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.txt +31 -18
- data/Rakefile +1 -0
- data/TODO.txt +8 -1
- data/lib/youtube_g.rb +1 -1
- data/lib/youtube_g/model/video.rb +2 -0
- data/test/test_client.rb +4 -4
- metadata +4 -4
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -3,32 +3,46 @@ youtube-g
|
|
3
3
|
http://rubyforge.org/projects/youtube-g/
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
|
-
|
7
|
-
youtube-g is a pure Ruby client for the YouTube GData API.
|
6
|
+
|
7
|
+
youtube-g is a pure Ruby client for the YouTube GData API. It provides an easy
|
8
|
+
way to access the latest YouTube video search results from your own programs.
|
9
|
+
In comparison with the earlier Youtube search interfaces, this new API and
|
10
|
+
library offers much-improved flexibility around executing complex search
|
11
|
+
queries to obtain well-targeted video search results.
|
12
|
+
|
13
|
+
More detail on the underlying source Google-provided API is available at:
|
14
|
+
|
15
|
+
http://code.google.com/apis/youtube/overview.html
|
8
16
|
|
9
17
|
== FEATURES/PROBLEMS:
|
10
18
|
|
11
|
-
* Aims to be in parity with Google's YouTube GData API
|
19
|
+
* Aims to be in parity with Google's YouTube GData API. Core functionality
|
20
|
+
is currently present -- work is in progress to fill in the rest.
|
12
21
|
|
13
22
|
== SYNOPSIS:
|
14
23
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
Create a client:
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'youtube_g'
|
28
|
+
client = YouTubeG::Client.new
|
29
|
+
|
30
|
+
Basic queries:
|
31
|
+
|
32
|
+
client.videos_by(:query => "penguin")
|
33
|
+
client.videos_by(:tags => ['tiger', 'leopard'])
|
34
|
+
client.videos_by(:categories => [:news, :sports])
|
35
|
+
client.videos_by(:categories => [:news, :sports], :tags => ['soccer', 'football'])
|
36
|
+
client.videos_by(:user => 'liz')
|
23
37
|
|
24
|
-
|
38
|
+
Standard feeds:
|
25
39
|
|
26
|
-
|
27
|
-
|
40
|
+
client.videos_by(:most_viewed)
|
41
|
+
client.videos_by(:top_rated, :time => :today)
|
28
42
|
|
29
|
-
|
43
|
+
Advanced queries (with boolean operators OR (either), AND (include), NOT (exclude)):
|
30
44
|
|
31
|
-
|
45
|
+
client.videos_by(:categories => { :either => [:news, :sports], :exclude => [:comedy] }, :tags => { :include => ['football'], :exclude => ['soccer'] })
|
32
46
|
|
33
47
|
|
34
48
|
== REQUIREMENTS:
|
@@ -43,8 +57,7 @@ youtube-g is a pure Ruby client for the YouTube GData API.
|
|
43
57
|
|
44
58
|
MIT License
|
45
59
|
|
46
|
-
Copyright (c) 2007 Shane Vitarana
|
47
|
-
Copyright (c) 2007 Walter Korman
|
60
|
+
Copyright (c) 2007 Shane Vitarana and Walter Korman
|
48
61
|
|
49
62
|
Permission is hereby granted, free of charge, to any person obtaining
|
50
63
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -10,6 +10,7 @@ Hoe.new('youtube-g', YouTubeG::VERSION) do |p|
|
|
10
10
|
p.description = p.paragraphs_of('README.txt', 2..8).join("\n\n")
|
11
11
|
p.url = 'http://rubyforge.org/projects/youtube-g/'
|
12
12
|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
13
|
+
p.remote_rdoc_dir = ''
|
13
14
|
end
|
14
15
|
|
15
16
|
desc 'Tag release'
|
data/TODO.txt
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
-
[ ]
|
1
|
+
[ ] stub out http request/response cycle for tests
|
2
|
+
[ ] consider defaulting the client to no-logger, rather than outputting to STDOUT.
|
3
|
+
[ ] allow specifying values as single items where you don't need to wrap in a list, e.g. :tags => :chickens instead of :tags => [ 'chickens' ]
|
4
|
+
[ ] make sure symbols will work as well as tags everywhere (again, :tags => :chickens is same as :tags => 'chickens')
|
5
|
+
[ ] figure out better structure for class/file (either rename request/video_search.rb or split into one class per file again)
|
6
|
+
[ ] restore spaces after method def names
|
7
|
+
[ ] use a proxy for testing with static sample result xml so we have repeatable tests
|
2
8
|
[ ] Clean up tests using Shoulda to define contexts
|
3
9
|
[ ] Consolidate requires
|
4
10
|
[ ] Allow :category and :categories for query DSL
|
11
|
+
[ ] Exception handling
|
5
12
|
|
6
13
|
== API Features TODO
|
7
14
|
|
data/lib/youtube_g.rb
CHANGED
data/test/test_client.rb
CHANGED
@@ -12,9 +12,9 @@ class TestClient < Test::Unit::TestCase
|
|
12
12
|
def test_should_respond_to_a_basic_query
|
13
13
|
response = @client.videos_by(:query => "penguin")
|
14
14
|
|
15
|
-
assert_equal "http://gdata.youtube.com/feeds/api/videos", response.feed_id
|
15
|
+
assert_equal "http://gdata.youtube.com/feeds/api/videos?start-index=1&max-results=25&vq=penguin", response.feed_id
|
16
16
|
assert_equal 25, response.max_result_count
|
17
|
-
assert_equal
|
17
|
+
assert_equal 25, response.videos.length
|
18
18
|
assert_equal 1, response.offset
|
19
19
|
assert(response.total_result_count > 100)
|
20
20
|
assert_instance_of Time, response.updated_at
|
@@ -25,7 +25,7 @@ class TestClient < Test::Unit::TestCase
|
|
25
25
|
def test_should_get_videos_for_multiword_metasearch_query
|
26
26
|
response = @client.videos_by(:query => 'christina ricci')
|
27
27
|
|
28
|
-
assert_equal "http://gdata.youtube.com/feeds/api/videos", response.feed_id
|
28
|
+
assert_equal "http://gdata.youtube.com/feeds/api/videos?start-index=1&max-results=25&vq=christina+ricci", response.feed_id
|
29
29
|
assert_equal 25, response.max_result_count
|
30
30
|
assert_equal 25, response.videos.length
|
31
31
|
assert_equal 1, response.offset
|
@@ -104,7 +104,7 @@ class TestClient < Test::Unit::TestCase
|
|
104
104
|
def test_should_get_videos_for_query_search_with_categories_excluded
|
105
105
|
response = @client.videos_by(:query => 'bench press', :categories => { :exclude => [:comedy, :entertainment] },
|
106
106
|
:max_results => 10)
|
107
|
-
assert_equal "<object width=\"425\" height=\"350\">\n <param name=\"movie\" value=\"http://www.youtube.com/v/
|
107
|
+
assert_equal "<object width=\"425\" height=\"350\">\n <param name=\"movie\" value=\"http://www.youtube.com/v/BlDWdfTAx8o\"></param>\n <param name=\"wmode\" value=\"transparent\"></param>\n <embed src=\"http://www.youtube.com/v/BlDWdfTAx8o\" type=\"application/x-shockwave-flash\" \n wmode=\"transparent\" width=\"425\" height=\"350\"></embed>\n</object>\n", response.videos.first.embed_html
|
108
108
|
response.videos.each { |v| assert_valid_video v }
|
109
109
|
end
|
110
110
|
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: youtube-g
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date:
|
6
|
+
version: 0.4.1
|
7
|
+
date: 2008-02-11 00:00:00 -06:00
|
8
8
|
summary: Ruby client for the YouTube GData API
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: shanev@gmail.com
|
12
12
|
homepage: http://rubyforge.org/projects/youtube-g/
|
13
13
|
rubyforge_project: youtube-g
|
14
|
-
description: "== FEATURES/PROBLEMS: * Aims to be in parity with Google's YouTube GData API
|
14
|
+
description: "youtube-g is a pure Ruby client for the YouTube GData API. It provides an easy way to access the latest YouTube video search results from your own programs. In comparison with the earlier Youtube search interfaces, this new API and library offers much-improved flexibility around executing complex search queries to obtain well-targeted video search results. More detail on the underlying source Google-provided API is available at: http://code.google.com/apis/youtube/overview.html == FEATURES/PROBLEMS: * Aims to be in parity with Google's YouTube GData API. Core functionality is currently present -- work is in progress to fill in the rest. == SYNOPSIS: Create a client: require 'rubygems' require 'youtube_g' client = YouTubeG::Client.new Basic queries: client.videos_by(:query => \"penguin\") client.videos_by(:tags => ['tiger', 'leopard']) client.videos_by(:categories => [:news, :sports]) client.videos_by(:categories => [:news, :sports], :tags => ['soccer', 'football']) client.videos_by(:user => 'liz') Standard feeds: client.videos_by(:most_viewed) client.videos_by(:top_rated, :time => :today) Advanced queries (with boolean operators OR (either), AND (include), NOT (exclude)): client.videos_by(:categories => { :either => [:news, :sports], :exclude => [:comedy] }, :tags => { :include => ['football'], :exclude => ['soccer'] })"
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -80,5 +80,5 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.
|
83
|
+
version: 1.5.0
|
84
84
|
version:
|