muri 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/muri/filters/facebook.rb +2 -2
- data/lib/muri/filters/flickr.rb +16 -16
- data/lib/muri/filters/photobucket.rb +7 -5
- data/lib/muri/filters/vimeo.rb +55 -6
- data/lib/muri/filters/youtube.rb +1 -1
- data/muri.gemspec +2 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -15,7 +15,7 @@ class Muri
|
|
15
15
|
|
16
16
|
def facebook_parse
|
17
17
|
@info[:service] = 'Facebook'
|
18
|
-
params = @url.query.nil? ? {} : CGI::parse(@url.query)
|
18
|
+
params = @url.query.nil? ? {} : CGI::parse(@url.query)#.each {|k,v| b[k] = v.first}
|
19
19
|
url_common = "http://www.facebook.com"
|
20
20
|
|
21
21
|
# if @url.path =~ /^\/v\/([0-9]+)/
|
@@ -50,7 +50,7 @@ class Muri
|
|
50
50
|
end
|
51
51
|
|
52
52
|
if self.valid?
|
53
|
-
# The media_api_id is the PID which can be searched for in the facebook photos table
|
53
|
+
# The media_api_id is the PID which can be searched for in the facebook photos/albums table
|
54
54
|
@info[:media_api_id] = (media_creator.to_i << 32) + @info[:media_id].to_i
|
55
55
|
else
|
56
56
|
raise UnsupportedURI
|
data/lib/muri/filters/flickr.rb
CHANGED
@@ -14,30 +14,20 @@ class Muri
|
|
14
14
|
def flickr_parse
|
15
15
|
@info[:service] = 'Flickr'
|
16
16
|
|
17
|
-
if @url.path =~ /^\/photos\/([a-z0-9\-\_\@]
|
17
|
+
if @url.path =~ /^\/photos\/([a-z0-9\-\_\@]+?)\/(sets\/)?([0-9]+)/i
|
18
18
|
media_creator = $1
|
19
19
|
@info[:media_id] = $3
|
20
20
|
@info[:media_api_type] = $2.nil? ? FLICKR_PHOTO : FLICKR_SET
|
21
|
-
elsif (@url.host + @url.path) =~ /^farm([1-3])\.static.flickr.com\/([0-9]
|
21
|
+
elsif (@url.host + @url.path) =~ /^farm([1-3])\.static.flickr.com\/([0-9]+?)\/([0-9]+?)\_([a-z0-9]+?)(\_[a-z]){0,1}\.([a-z]+)/i
|
22
22
|
farm = $1
|
23
23
|
server_id = $2
|
24
24
|
@info[:media_id] = $3
|
25
25
|
@info[:media_api_type] = FLICKR_PHOTO
|
26
26
|
media_secret = $4
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# when '_m' then 'medium'
|
32
|
-
# when '_b' then 'large'
|
33
|
-
# else nil
|
34
|
-
# end
|
35
|
-
# end
|
36
|
-
# @info[:content_type] = $6
|
37
|
-
url_prefix = "http://farm#{farm}.static.flickr.com/#{server_id}/#{@info[:media_id]}_#{media_secret}"
|
38
|
-
@info[:media_url] = "#{url_prefix}.jpg"
|
39
|
-
@info[:media_thumbnail] = "#{url_prefix}_t.jpg"
|
40
|
-
elsif (@url.host + @url.path) =~ /^flic\.kr\/p\/([a-z0-9]*)/i
|
27
|
+
url_prefix = "http://farm#{farm}.static.flickr.com/#{server_id}/#{@info[:media_id]}_#{media_secret}"
|
28
|
+
@info[:media_url] = "#{url_prefix}.jpg"
|
29
|
+
@info[:media_thumbnail] = "#{url_prefix}_t.jpg"
|
30
|
+
elsif (@url.host + @url.path) =~ /^flic\.kr\/p\/([a-z0-9]+)/i
|
41
31
|
@info[:media_id] = self.class.decode58($1)
|
42
32
|
@info[:media_api_type] = FLICKR_PHOTO
|
43
33
|
end
|
@@ -64,6 +54,16 @@ class Muri
|
|
64
54
|
end
|
65
55
|
end
|
66
56
|
end
|
57
|
+
# if !$5.nil?
|
58
|
+
# @info[:media_size] = case $5.downcase
|
59
|
+
# when '_s' then 'small'
|
60
|
+
# when '_t' then 'thumbnail'
|
61
|
+
# when '_m' then 'medium'
|
62
|
+
# when '_b' then 'large'
|
63
|
+
# else nil
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
# @info[:content_type] = $6
|
67
67
|
# http://www.flickr.com/photos/bananastalktome/2088436532/ (preview)
|
68
68
|
# http://flic.kr/p/4bxMqq (preview)
|
69
69
|
# http://farm3.static.flickr.com/2178/2088436532_ee07b4474e_m.jpg (direct)
|
@@ -16,10 +16,11 @@ class Muri
|
|
16
16
|
def photobucket_parse
|
17
17
|
@info[:service] = 'Photobucket'
|
18
18
|
|
19
|
-
@url.host =~ /^([a-z0-9]*?[^(media)])\.photobucket\.com
|
19
|
+
@url.host =~ /^([a-z0-9]*?[^(media)])\.photobucket\.com$/i
|
20
20
|
@info[:server_id] = $1.gsub(/([a-z]*)/i,"")
|
21
21
|
|
22
|
-
if @url.path =~ /^\/albums\/(.+?)\/(.+?)\/((
|
22
|
+
if @url.path =~ /^\/albums\/(.+?)\/(.+?)\/(?:(.*)\/)*(.+?)\.(.+?)$/i #Images
|
23
|
+
# OLD: /^\/albums\/(.+?)\/(.+?)\/((?:.+?\/)*)(.+?)\.(.+)/i
|
23
24
|
photobucket_id = $1
|
24
25
|
media_creator = $2
|
25
26
|
album = $3
|
@@ -30,7 +31,8 @@ class Muri
|
|
30
31
|
@info[:media_api_type] = PHOTOBUCKET_MEDIA
|
31
32
|
@info[:media_url] = "http://i#{direct_url_suffix}"
|
32
33
|
@info[:website] = "http://s#{url_common}?action=view¤t=#{@info[:media_id]}.#{@info[:content_type]}"
|
33
|
-
elsif @url.path =~ /^\/albums\/(.+?)\/(.+?)\/(
|
34
|
+
elsif @url.path =~ /^\/albums\/(.+?)\/(.+?)\/(.[^\.]*?)\/?$/i #Albums
|
35
|
+
# OLD: /^\/albums\/(.+?)\/(.+?)\/((?:.[^\/]+?)+)(?:\/|$)/i
|
34
36
|
photobucket_id = $1
|
35
37
|
media_creator = $2
|
36
38
|
album = $3
|
@@ -38,7 +40,7 @@ class Muri
|
|
38
40
|
url_common = "#{server_id}.photobucket.com/albums/#{photobucket_id}/#{media_creator}/#{album}"
|
39
41
|
@info[:media_api_type] = PHOTOBUCKET_ALBUM
|
40
42
|
@info[:website] = "http://s#{url_common}/"
|
41
|
-
elsif @url.path =~ /^\/groups\/(.+?)\/(.+?)\/(.+?)\.(.+)
|
43
|
+
elsif @url.path =~ /^\/groups\/(.+?)\/(.+?)\/(.+?)\.(.+)$/i #Group Images
|
42
44
|
group = $1
|
43
45
|
group_hash_value = $2
|
44
46
|
@info[:media_id] = $3
|
@@ -48,7 +50,7 @@ class Muri
|
|
48
50
|
@info[:media_api_type] = PHOTOBUCKET_MEDIA
|
49
51
|
@info[:media_url] = "http://gi#{direct_url_suffix}"
|
50
52
|
@info[:website] = "http://gs#{url_common}/?action=view¤t=#{@info[:media_id]}.#{@info[:content_type]}"
|
51
|
-
elsif @url.path =~ /^\/groups\/(
|
53
|
+
elsif @url.path =~ /^\/groups\/(\w+?)\/(\w+?)\/?$/i #Group Album
|
52
54
|
group = $1
|
53
55
|
group_hash_value = $2
|
54
56
|
url_common = "#{server_id}.photobucket.com/groups/#{group}/#{group_hash_value}"
|
data/lib/muri/filters/vimeo.rb
CHANGED
@@ -14,16 +14,65 @@ class Muri
|
|
14
14
|
|
15
15
|
def vimeo_parse
|
16
16
|
@info[:service] = 'Vimeo'
|
17
|
-
params = @url.query.nil? ? {} : CGI::parse(@url.query)
|
18
|
-
|
19
|
-
|
17
|
+
params = @url.query.nil? ? {} : CGI::parse(@url.query)#.each {|k,v| b[k] = v.first}
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
if @url.path =~ /^\/(album\/)?([0-9]+)\/?$/i
|
20
69
|
@info[:media_id] = $2
|
21
70
|
@info[:media_api_type] = $1.nil? ? VIMEO_VIDEO : VIMEO_ALBUM
|
22
|
-
elsif @url.path =~ /^\/groups\/([0-9a-z\@\-\_]+)\/videos\/([0-9]+)
|
71
|
+
elsif @url.path =~ /^\/groups\/([0-9a-z\@\-\_]+)\/videos\/([0-9]+)\/?$/i
|
23
72
|
@info[:media_id] = $2
|
24
73
|
@info[:media_api_type] = VIMEO_VIDEO
|
25
|
-
elsif ((@url.path =~ /^\/moogaloop\.swf$/i) && (params.include?("clip_id")))
|
26
|
-
@info[:media_id] = params["clip_id"].first
|
74
|
+
elsif ((@url.path =~ /^\/moogaloop\.swf$/i) && (params.include?("clip_id")) && (params["clip_id"].first =~ /^([0-9]+)$/))
|
75
|
+
@info[:media_id] = params["clip_id"].first
|
27
76
|
@info[:media_api_type] = VIMEO_VIDEO
|
28
77
|
end
|
29
78
|
|
data/lib/muri/filters/youtube.rb
CHANGED
@@ -15,7 +15,7 @@ class Muri
|
|
15
15
|
def youtube_parse
|
16
16
|
@info[:service] = 'Youtube'
|
17
17
|
url_common = "http://www.youtube.com"
|
18
|
-
params = @url.query.nil? ? {} : CGI::parse(@url.query)
|
18
|
+
params = @url.query.nil? ? {} : CGI::parse(@url.query)#.each {|k,v| b[k] = v.first}
|
19
19
|
|
20
20
|
if (@url.path =~ /^\/watch$/i) && params.include?("v")
|
21
21
|
@info[:media_id] = params["v"].first
|
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.11"
|
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-21}
|
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 = [
|
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.11
|
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-21 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|