muri 0.0.3 → 0.0.4
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.
- data/README.rdoc +21 -14
- data/VERSION.yml +1 -1
- data/lib/muri/base.rb +15 -9
- data/lib/muri/filters/flickr.rb +7 -4
- data/lib/muri/filters/imageshack.rb +6 -4
- data/lib/muri/filters/photobucket.rb +6 -4
- data/lib/muri/filters/vimeo.rb +7 -7
- data/lib/muri/filters/youtube.rb +6 -4
- data/muri.gemspec +7 -5
- data/test/error_test.rb +27 -0
- data/test/flickr_test.rb +4 -4
- data/test/imageshack_test.rb +4 -4
- data/test/photobucket_test.rb +11 -11
- data/test/vimeo_test.rb +4 -4
- data/test/youtube_test.rb +4 -4
- metadata +6 -4
data/README.rdoc
CHANGED
@@ -20,25 +20,32 @@ Using muri is just as easy!
|
|
20
20
|
a = Muri.parse('http://www.youtube.com/watch?v=blahblahblah&feature=rec-LGOUT-exp_fresh+div-1r-1-HM')
|
21
21
|
a.service # 'Youtube'
|
22
22
|
a.media_id # 'blahblahblah'
|
23
|
-
a.media_url # 'http://www.youtube.com/watch?v=blahblahblah' (flickr media_url's provide the flic.kr/p/ID short url)
|
24
23
|
a.original_url # 'http://www.youtube.com/watch?v=blahblahblah&feature=rec-LGOUT-exp_fresh+div-1r-1-HM'
|
25
24
|
a.uri # URI object for 'http://www.youtube.com/watch?v=blahblahblah&feature=rec-LGOUT-exp_fresh+div-1r-1-HM'
|
26
25
|
|
27
26
|
Due to variations in information which can be gathered from a uri, some services provide more information than others. For example:
|
28
|
-
|
29
|
-
a.media_api_id # 'blahblahblah'
|
30
|
-
|
31
|
-
* A direct media url for Youtube, Photobucket, and Flickr (http://img#{num}.imageshack.us/img#{num}/#{NUMBER}/#{IMAGENAME} format)
|
32
|
-
a.website # 'http://www.youtube.com/v/blahblahblah'
|
33
|
-
|
34
|
-
* Content type for Imageshack, Photobucket and Flickr URI's (flickr in the http://farm#{num}.static.flickr.com/ format)
|
35
|
-
a.content_type # 'jpg' (Content Type also for Imageshack and Photobucket)
|
36
|
-
|
37
|
-
* Thumbnails URL for Youtube Photobucket, and Flickr (flickr in the http://farm#{num}.static.flickr.com/ format)
|
38
|
-
a.media_thumbnail
|
39
|
-
|
40
|
-
* Some additional information may be provided, which can be determined by looking through each filters code.
|
27
|
+
* All but Imageshack have a +media_api_id+, which is the ID which can be used in API calls to the related services. Typically the same as +media_id+.
|
41
28
|
|
29
|
+
a.media_api_id # 'blahblahblah'
|
30
|
+
|
31
|
+
* A direct media url for Youtube, Photobucket, and Imageshack (img#{num}.imageshack.us/img#{num}/#{NUMBER}/#{IMAGENAME} format)
|
32
|
+
|
33
|
+
a.media_url # 'http://www.youtube.com/v/blahblahblah'
|
34
|
+
|
35
|
+
* A media landing website url for Youtube, Photobucket, Imageshack, Vimeo, and Flickr (flickr media_url's provide the flic.kr/p/ID short url)
|
36
|
+
|
37
|
+
a.website # 'http://www.youtube.com/watch?v=blahblahblah'
|
38
|
+
|
39
|
+
* Content type for Imageshack, Photobucket and Flickr URI's (flickr in the farm#{num}.static.flickr.com/ format)
|
40
|
+
|
41
|
+
a.content_type # 'jpg' (Content Type also for Imageshack and Photobucket)
|
42
|
+
|
43
|
+
* Thumbnails URL for Youtube Photobucket, and Flickr (flickr in the farm#{num}.static.flickr.com/ format)
|
44
|
+
|
45
|
+
a.media_thumbnail # 'http://i.ytimg.com/vi/4CYDFoEz8rg/default.jpg'
|
46
|
+
|
47
|
+
* Some additional information may be provided, which can be determined by looking through each filters code.
|
48
|
+
|
42
49
|
|
43
50
|
If an attribute is not present, muri returns +nil+.
|
44
51
|
|
data/VERSION.yml
CHANGED
data/lib/muri/base.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'uri'
|
2
2
|
class Muri
|
3
|
+
|
4
|
+
# NoParser raised if no parser is found for URI
|
3
5
|
class NoParser < StandardError; end
|
6
|
+
|
7
|
+
# UnsupportedURI raised if parser is found, but URI path does not
|
8
|
+
# match accepted formats
|
9
|
+
class UnsupportedURI < ArgumentError; end
|
4
10
|
|
5
11
|
PARSERS = {}
|
6
12
|
|
@@ -66,17 +72,17 @@ class Muri
|
|
66
72
|
end
|
67
73
|
|
68
74
|
def method_missing(func, args = nil)
|
69
|
-
if @info[func.to_sym] != nil
|
70
|
-
@info[func.to_sym]
|
71
|
-
else
|
72
|
-
|
73
|
-
end
|
75
|
+
#if @info[func.to_sym] != nil
|
76
|
+
@info[func.to_sym].nil? ? nil : @info[func.to_sym]
|
77
|
+
#else
|
78
|
+
# nil #super(func,args)
|
79
|
+
#end
|
74
80
|
end
|
75
81
|
|
76
82
|
protected
|
77
83
|
|
78
84
|
#used by flickr. Ported from PHP.
|
79
|
-
def decode58(str)
|
85
|
+
def self.decode58(str)
|
80
86
|
decoded = 0
|
81
87
|
multi = 1
|
82
88
|
alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
@@ -91,15 +97,15 @@ class Muri
|
|
91
97
|
end
|
92
98
|
|
93
99
|
#used by flickr. Ported from PHP.
|
94
|
-
def encode58(str)
|
100
|
+
def self.encode58(str)
|
95
101
|
alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
96
102
|
base_count = alphabet.length
|
97
103
|
encoded = ''
|
98
104
|
while str >= base_count
|
99
105
|
div = str / base_count
|
100
|
-
mod = (str-(base_count * div
|
106
|
+
mod = (str-(base_count * div))
|
101
107
|
encoded = alphabet[mod,1] + encoded
|
102
|
-
str = div
|
108
|
+
str = div
|
103
109
|
end
|
104
110
|
encoded = (alphabet[str,1] + encoded) if str
|
105
111
|
encoded
|
data/lib/muri/filters/flickr.rb
CHANGED
@@ -31,12 +31,14 @@ class Muri
|
|
31
31
|
# @info[:content_type] = $6
|
32
32
|
@info[:media_thumbnail] = "http://farm#{farm}.static.flickr.com/#{server_id}/#{@info[:media_id]}_#{media_secret}_t.jpg"
|
33
33
|
elsif (@url.host + @url.path) =~ /^flic\.kr\/p\/([a-z0-9]*)/i
|
34
|
-
@info[:media_id] = self.decode58($1)
|
34
|
+
@info[:media_id] = self.class.decode58($1)
|
35
35
|
end
|
36
36
|
|
37
37
|
if self.parsed?
|
38
38
|
@info[:media_api_id] = @info[:media_id]
|
39
|
-
@info[:
|
39
|
+
@info[:website] = "http://flic.kr/p/" + self.class.encode58(@info[:media_id].to_i)
|
40
|
+
else
|
41
|
+
raise UnsupportedURI
|
40
42
|
end
|
41
43
|
|
42
44
|
self
|
@@ -50,8 +52,9 @@ class Muri
|
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
53
|
-
# http://www.flickr.com/photos/bananastalktome/2088436532/
|
54
|
-
# http://
|
55
|
+
# http://www.flickr.com/photos/bananastalktome/2088436532/ (preview)
|
56
|
+
# http://flic.kr/p/4bxMqq (preview)
|
57
|
+
# http://farm3.static.flickr.com/2178/2088436532_ee07b4474e_m.jpg (direct)
|
55
58
|
# farm-id: 3
|
56
59
|
# server-id: 2178
|
57
60
|
# photo-id: 2088436532
|
@@ -22,12 +22,14 @@ class Muri
|
|
22
22
|
content_path_id = $2
|
23
23
|
@info[:media_id] = $3
|
24
24
|
@info[:content_type] = $4
|
25
|
-
@info[:
|
25
|
+
@info[:media_url] = "#{url_common}/img#{server_id}/#{content_server_id}/#{@info[:media_id]}.#{@info[:content_type]}"
|
26
26
|
end
|
27
27
|
|
28
28
|
# imageshack does not currently have API for retrieving individual video information
|
29
29
|
if self.parsed?
|
30
|
-
@info[:
|
30
|
+
@info[:website] = "#{url_common}/i/#{@info[:media_id]}.#{@info[:content_type]}/"
|
31
|
+
else
|
32
|
+
raise UnsupportedURI
|
31
33
|
end
|
32
34
|
|
33
35
|
self
|
@@ -40,8 +42,8 @@ class Muri
|
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
43
|
-
# http://img178.imageshack.us/i/dsc01576lo7.jpg/
|
44
|
-
# http://img178.imageshack.us/img178/773/dsc01576lo7.jpg
|
45
|
+
# http://img178.imageshack.us/i/dsc01576lo7.jpg/ (preview)
|
46
|
+
# http://img178.imageshack.us/img178/773/dsc01576lo7.jpg (direct)
|
45
47
|
# http://yfrog.com/4ydsc01576lo7j
|
46
48
|
|
47
49
|
# http://img30.imageshack.us/img30/4184/rush02.mp4
|
@@ -23,8 +23,8 @@ class Muri
|
|
23
23
|
url_common = "#{server_id}.photobucket.com/albums/#{photobucket_id}/#{media_creator}/#{album}"
|
24
24
|
direct_url_suffix = "#{url_common}#{@info[:media_id]}.#{@info[:content_type]}"
|
25
25
|
|
26
|
-
@info[:
|
27
|
-
@info[:
|
26
|
+
@info[:media_url] = "http://i#{direct_url_suffix}"
|
27
|
+
@info[:website] = "http://s#{url_common}?action=view¤t=#{@info[:media_id]}.#{@info[:content_type]}"
|
28
28
|
elsif @url.path =~ /^\/groups\/(.*?)\/(.*?)\/(.*?)\.(.*)/i
|
29
29
|
group = $1
|
30
30
|
group_hash_value = $2
|
@@ -33,13 +33,15 @@ class Muri
|
|
33
33
|
url_common = "#{server_id}.photobucket.com/groups/#{group}/#{group_hash_value}"
|
34
34
|
direct_url_suffix = "#{url_common}/#{@info[:media_id]}.#{@info[:content_type]}"
|
35
35
|
|
36
|
-
@info[:
|
37
|
-
@info[:
|
36
|
+
@info[:media_url] = "http://gi#{direct_url_suffix}"
|
37
|
+
@info[:website] = "http://gs#{url_common}/?action=view¤t=#{@info[:media_id]}.#{@info[:content_type]}"
|
38
38
|
end
|
39
39
|
|
40
40
|
if self.parsed?
|
41
41
|
@info[:media_api_id] = @info[:media_url]
|
42
42
|
@info[:media_thumbnail] = "http://mobth#{direct_url_suffix}"
|
43
|
+
else
|
44
|
+
raise UnsupportedURI
|
43
45
|
end
|
44
46
|
|
45
47
|
self
|
data/lib/muri/filters/vimeo.rb
CHANGED
@@ -11,19 +11,19 @@ class Muri
|
|
11
11
|
|
12
12
|
def vimeo_parse
|
13
13
|
@info[:service] = 'Vimeo'
|
14
|
+
params = CGI::parse(@url.query) if !@url.query.nil?
|
14
15
|
|
15
|
-
if @url.path =~ /^\/([0-9]
|
16
|
+
if @url.path =~ /^\/([0-9]+)/
|
16
17
|
@info[:media_id] = $1
|
17
|
-
elsif (@url.path =~ /^\/moogaloop\.swf/i)
|
18
|
-
|
19
|
-
if params.include?("clip_id")
|
20
|
-
@info[:media_id] = params["clip_id"].first if (params["clip_id"].first =~ /([0-9]*)/)
|
21
|
-
end
|
18
|
+
elsif ((@url.path =~ /^\/moogaloop\.swf/i) && (params.include?("clip_id")))
|
19
|
+
@info[:media_id] = params["clip_id"].first if (params["clip_id"].first =~ /([0-9]*)/)
|
22
20
|
end
|
23
21
|
|
24
22
|
if self.parsed?
|
25
23
|
@info[:media_api_id] = @info[:media_id]
|
26
|
-
@info[:
|
24
|
+
@info[:website] = "http://vimeo.com/#{@info[:media_id]}"
|
25
|
+
else
|
26
|
+
raise UnsupportedURI
|
27
27
|
end
|
28
28
|
|
29
29
|
self
|
data/lib/muri/filters/youtube.rb
CHANGED
@@ -21,10 +21,12 @@ class Muri
|
|
21
21
|
end
|
22
22
|
|
23
23
|
if self.parsed?
|
24
|
-
@info[:
|
25
|
-
@info[:
|
24
|
+
@info[:website] = "#{url_common}/watch?v=#{@info[:media_id]}"
|
25
|
+
@info[:media_url] = "#{url_common}/v/#{@info[:media_id]}"
|
26
26
|
@info[:media_api_id] = @info[:media_id]
|
27
27
|
@info[:media_thumbnail] = "http://i.ytimg.com/vi/#{@info[:media_id]}/default.jpg"
|
28
|
+
else
|
29
|
+
raise UnsupportedURI
|
28
30
|
end
|
29
31
|
|
30
32
|
self
|
@@ -35,5 +37,5 @@ class Muri
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
38
|
-
# http://www.youtube.com/v/4CYDFoEz8rg&hl=en_US&fs=1&
|
39
|
-
# http://www.youtube.com/watch?v=l983Uob0Seo&feature=rec-LGOUT-exp_fresh+div-1r-1-HM
|
40
|
+
# http://www.youtube.com/v/4CYDFoEz8rg&hl=en_US&fs=1& (direct)
|
41
|
+
# http://www.youtube.com/watch?v=l983Uob0Seo&feature=rec-LGOUT-exp_fresh+div-1r-1-HM (preview)
|
data/muri.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muri}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["William Schneider"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-02}
|
13
13
|
s.description = %q{Automatically get media information from the URL.}
|
14
14
|
s.email = %q{bananastalktome@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/muri/filters/vimeo.rb",
|
30
30
|
"lib/muri/filters/youtube.rb",
|
31
31
|
"muri.gemspec",
|
32
|
+
"test/error_test.rb",
|
32
33
|
"test/flickr_test.rb",
|
33
34
|
"test/imageshack_test.rb",
|
34
35
|
"test/photobucket_test.rb",
|
@@ -41,10 +42,11 @@ Gem::Specification.new do |s|
|
|
41
42
|
s.rubygems_version = %q{1.3.5}
|
42
43
|
s.summary = %q{Media URI Parser}
|
43
44
|
s.test_files = [
|
44
|
-
"test/
|
45
|
-
"test/imageshack_test.rb",
|
46
|
-
"test/photobucket_test.rb",
|
45
|
+
"test/photobucket_test.rb",
|
47
46
|
"test/vimeo_test.rb",
|
47
|
+
"test/imageshack_test.rb",
|
48
|
+
"test/error_test.rb",
|
49
|
+
"test/flickr_test.rb",
|
48
50
|
"test/youtube_test.rb"
|
49
51
|
]
|
50
52
|
|
data/test/error_test.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'lib/muri.rb'
|
2
|
+
|
3
|
+
describe "Parse Errors" do
|
4
|
+
@no_parser = ["http://media.photobucket.com/image/searchterm/pbapi/file.jpg",
|
5
|
+
"http://pic.pbsrc.com/dev_help/WebHelpPublic/PhotobucketPublicHelp.htm"]
|
6
|
+
|
7
|
+
@unsupported = ["http://gi0006.photobucket.com/groups/0006/",
|
8
|
+
"http://www.flickr.com/photos",
|
9
|
+
"http://img178.imageshack.us/img178/",
|
10
|
+
"http://img178.imageshack.us/img178/773/",
|
11
|
+
"http://vimeo.com/",
|
12
|
+
"http://vimeo.com/moogaloop.swf?server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1",
|
13
|
+
"http://vimeo.com/moogaloop.swf?server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1"]
|
14
|
+
|
15
|
+
@no_parser.each do |a|
|
16
|
+
it "#{a} should raise NoParser" do
|
17
|
+
lambda { Muri.parse a }.should raise_exception(Muri::NoParser)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
@unsupported.each do |b|
|
22
|
+
it "#{b} should raise UnsupportedURI" do
|
23
|
+
lambda { Muri.parse b }.should raise_exception(Muri::UnsupportedURI)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/test/flickr_test.rb
CHANGED
@@ -9,8 +9,8 @@ shared_examples_for "Flickr parse" do
|
|
9
9
|
@a.media_id == '2088436532'
|
10
10
|
end
|
11
11
|
|
12
|
-
it "should have
|
13
|
-
@a.
|
12
|
+
it "should have a website" do
|
13
|
+
@a.website == 'http://flic.kr/p/4bxMqq'
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should have media api id" do
|
@@ -18,13 +18,13 @@ shared_examples_for "Flickr parse" do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
describe "Flickr parse first" do
|
21
|
-
before
|
21
|
+
before(:all) do
|
22
22
|
@a = Muri.parse 'http://www.flickr.com/photos/bananastalktome/2088436532/'
|
23
23
|
end
|
24
24
|
it_should_behave_like "Flickr parse"
|
25
25
|
end
|
26
26
|
describe "Flickr parse second" do
|
27
|
-
before
|
27
|
+
before(:all) do
|
28
28
|
@a = Muri.parse 'http://farm3.static.flickr.com/2178/2088436532_ee07b4474e_m.jpg'
|
29
29
|
end
|
30
30
|
it_should_behave_like "Flickr parse"
|
data/test/imageshack_test.rb
CHANGED
@@ -10,7 +10,7 @@ shared_examples_for "Imageshack parse" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should have media url" do
|
13
|
-
@a.
|
13
|
+
@a.website == 'http://img178.imageshack.us/i/dsc01576lo7.jpg/'
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should have content_type" do
|
@@ -18,18 +18,18 @@ shared_examples_for "Imageshack parse" do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
describe "Imageshack parse first" do
|
21
|
-
before
|
21
|
+
before(:all) do
|
22
22
|
@a = Muri.parse 'http://img178.imageshack.us/i/dsc01576lo7.jpg/'
|
23
23
|
end
|
24
24
|
it_should_behave_like "Imageshack parse"
|
25
25
|
end
|
26
26
|
describe "Imageshack parse second" do
|
27
|
-
before
|
27
|
+
before(:all) do
|
28
28
|
@a = Muri.parse 'http://img178.imageshack.us/img178/773/dsc01576lo7.jpg'
|
29
29
|
end
|
30
30
|
it_should_behave_like "Imageshack parse"
|
31
31
|
|
32
32
|
it "should have website" do
|
33
|
-
@a.
|
33
|
+
@a.media_url == 'http://img178.imageshack.us/img178/773/dsc01576lo7.jpg'
|
34
34
|
end
|
35
35
|
end
|
data/test/photobucket_test.rb
CHANGED
@@ -6,7 +6,7 @@ shared_examples_for "Photobucket parse" do
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
describe "Photobucket parse first" do
|
9
|
-
before
|
9
|
+
before(:all) do
|
10
10
|
@a = Muri.parse 'http://i244.photobucket.com/albums/gg17/pbapi/file.jpg'
|
11
11
|
end
|
12
12
|
it_should_behave_like "Photobucket parse"
|
@@ -19,12 +19,12 @@ describe "Photobucket parse first" do
|
|
19
19
|
@a.content_type == "jpg"
|
20
20
|
end
|
21
21
|
|
22
|
-
it "should have
|
23
|
-
@a.
|
22
|
+
it "should have a website" do
|
23
|
+
@a.website == "http://s244.photobucket.com/albums/gg17/pbapi/?action=view¤t=file.jpg"
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should have
|
27
|
-
@a.
|
26
|
+
it "should have media url" do
|
27
|
+
@a.media_url == "http://i244.photobucket.com/albums/gg17/pbapi/file.jpg"
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should have media api id" do
|
@@ -36,7 +36,7 @@ describe "Photobucket parse first" do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
describe "Photobucket parse second" do
|
39
|
-
before
|
39
|
+
before(:all) do
|
40
40
|
@a = Muri.parse 'http://gi0006.photobucket.com/groups/0006/G5PAK3TBQS/DSCF0015-1-1.jpg'
|
41
41
|
end
|
42
42
|
it_should_behave_like "Photobucket parse"
|
@@ -49,12 +49,12 @@ describe "Photobucket parse second" do
|
|
49
49
|
@a.content_type == "jpg"
|
50
50
|
end
|
51
51
|
|
52
|
-
it "should have
|
53
|
-
@a.
|
52
|
+
it "should have a website" do
|
53
|
+
@a.website == "http://gs0006.photobucket.com/groups/0006/G5PAK3TBQS/?action=view¤t=DSCF0015-1-1.jpg"
|
54
54
|
end
|
55
55
|
|
56
|
-
it "should have
|
57
|
-
@a.
|
56
|
+
it "should have media url" do
|
57
|
+
@a.media_url == "http://gi0006.photobucket.com/groups/0006/G5PAK3TBQS/DSCF0015-1-1.jpg"
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should have media thumbnail" do
|
@@ -64,4 +64,4 @@ describe "Photobucket parse second" do
|
|
64
64
|
it "should have media api id" do
|
65
65
|
@a.media_api_id == "http://gs0006.photobucket.com/groups/0006/G5PAK3TBQS/?action=view¤t=DSCF0015-1-1.jpg"
|
66
66
|
end
|
67
|
-
end
|
67
|
+
end
|
data/test/vimeo_test.rb
CHANGED
@@ -9,8 +9,8 @@ shared_examples_for "Vimeo parse" do
|
|
9
9
|
@a.media_id == '7312128'
|
10
10
|
end
|
11
11
|
|
12
|
-
it "should have
|
13
|
-
@a.
|
12
|
+
it "should have a website" do
|
13
|
+
@a.website == 'http://vimeo.com/7312128'
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should have media api id" do
|
@@ -18,13 +18,13 @@ shared_examples_for "Vimeo parse" do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
describe "Vimeo parse first" do
|
21
|
-
before
|
21
|
+
before(:all) do
|
22
22
|
@a = Muri.parse 'http://vimeo.com/moogaloop.swf?clip_id=7312128&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1'
|
23
23
|
end
|
24
24
|
it_should_behave_like "Vimeo parse"
|
25
25
|
end
|
26
26
|
describe "Vimeo parse second" do
|
27
|
-
before
|
27
|
+
before(:all) do
|
28
28
|
@a = Muri.parse 'http://vimeo.com/7312128'
|
29
29
|
end
|
30
30
|
it_should_behave_like "Vimeo parse"
|
data/test/youtube_test.rb
CHANGED
@@ -14,11 +14,11 @@ shared_examples_for "Youtube parse" do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should have media url" do
|
17
|
-
@a.
|
17
|
+
@a.website == 'http://www.youtube.com/watch?v=4CYDFoEz8rg'
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should have website" do
|
21
|
-
@a.
|
21
|
+
@a.media_url == 'http://www.youtube.com/v/4CYDFoEz8rg'
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should have thumbnail" do
|
@@ -26,13 +26,13 @@ shared_examples_for "Youtube parse" do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
describe "Youtube parse first" do
|
29
|
-
before
|
29
|
+
before(:all) do
|
30
30
|
@a = Muri.parse 'http://www.youtube.com/v/4CYDFoEz8rg&hl=en_US&fs=1&'
|
31
31
|
end
|
32
32
|
it_should_behave_like "Youtube parse"
|
33
33
|
end
|
34
34
|
describe "Youtube parse second" do
|
35
|
-
before
|
35
|
+
before(:all) do
|
36
36
|
@a = Muri.parse 'http://www.youtube.com/watch?v=4CYDFoEz8rg'
|
37
37
|
end
|
38
38
|
it_should_behave_like "Youtube parse"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Schneider
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-02 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/muri/filters/vimeo.rb
|
36
36
|
- lib/muri/filters/youtube.rb
|
37
37
|
- muri.gemspec
|
38
|
+
- test/error_test.rb
|
38
39
|
- test/flickr_test.rb
|
39
40
|
- test/imageshack_test.rb
|
40
41
|
- test/photobucket_test.rb
|
@@ -69,8 +70,9 @@ signing_key:
|
|
69
70
|
specification_version: 3
|
70
71
|
summary: Media URI Parser
|
71
72
|
test_files:
|
72
|
-
- test/flickr_test.rb
|
73
|
-
- test/imageshack_test.rb
|
74
73
|
- test/photobucket_test.rb
|
75
74
|
- test/vimeo_test.rb
|
75
|
+
- test/imageshack_test.rb
|
76
|
+
- test/error_test.rb
|
77
|
+
- test/flickr_test.rb
|
76
78
|
- test/youtube_test.rb
|