Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes plugins: flickr, twitpic, vimeo and xkcd

  • Loading branch information...
commit 56e6572d01236806ef78fb42a78aace441ea541a 1 parent b9569c3
@4poc 4poc authored
View
2  lib/remote/plugins/flickr.rb
@@ -4,7 +4,7 @@ class Flickr < Plugin
PATTERN = %r{http[s]?://(www\.)?flickr\.com/photos/}
def url
- search_one('.photo-div/img/@src, #allsizes-photo/img/@src') || super
+ match_one /o: {\s+url: '([^']+)'/
end
def title
View
6 lib/remote/plugins/twitpic.rb
@@ -11,7 +11,11 @@ def orig_url
end
def url
- search_one 'img[3]/@src'
+ search_one '#media-full img/@src'
+ end
+
+ def title
+ og_search 'title'
end
end
View
4 lib/remote/plugins/vimeo.rb
@@ -15,9 +15,5 @@ def url # return url to preview image
def title
og_search 'title'
end
-
- def tags
- search '.tags li a/text()'
- end
end
View
4 lib/remote/plugins/xkcd.rb
@@ -2,9 +2,9 @@ class Xkcd < Plugin
TYPE = 'image'
PATTERN = %r{xkcd\.(com|org)/\d*}
def url
- search_one('/html/body/div/div[2]/div/div[2]/div/div/img/@src') || super
+ search_one('#comic/img/@src') || super
end
def title
- search_one('.s h1/text()') || super
+ search_one('#ctitle/text()') || super
end
end
View
16 test/test_remote.rb
@@ -35,7 +35,7 @@ def test_url_patterns
'Imgur' => ['http://imgur.com/vXUwn'],
'Picpaste' => ['http://picpaste.com/test_42x42.png'],
'Soundcloud' => ['http://soundcloud.com/flux-pavilion/flux-pavilion-the-story-of-shadrok/'],
- 'Twitpic' => ['http://twitpic.com/5lg4ai'],
+ 'Twitpic' => ['http://twitpic.com/8rfe1u'],
'Vimeo' => ['http://vimeo.com/26134306'],
'Yfrog' => ['http://yfrog.com/gywkzgj'],
'Youtube' => ['http://www.youtube.com/watch?v=PXRX47L_3yE&feature=feedbul'],
@@ -67,7 +67,7 @@ def test_flickr
def test_fukung
plugin = Loader::create 'http://fukung.net/v/6873/catparrot.jpg'
assert_equal(plugin.url, 'http://media.fukung.net/images/6873/catparrot.jpg')
- assert_equal(plugin.tags, ["thegame", "animals", "tbag8uk"])
+ assert(plugin.tags.length > 0)
end
def test_imagenetz
@@ -99,7 +99,7 @@ def test_picpaste
def test_soundcloud
plugin = Loader::create 'http://soundcloud.com/flux-pavilion/flux-pavilion-the-story-of-shadrok/'
assert_equal(plugin.title, "Flux Pavilion - The Story Of Shadrok")
- assert_match(plugin.embed, %r{<object height="81"})
+ assert_match(plugin.embed, %r{<iframe})
plugin = Loader::create 'http://soundcloud.com/shlohmo/shell-of-light-shlohmo-remix'
assert(plugin.tags.include?("remix"),
"tags not scraped correctly? #{plugin.tags.inspect}")
@@ -113,21 +113,21 @@ def test_soupasset
end
def test_twitpic
- plugin = Loader::create 'http://twitpic.com/5lg4ai'
+ plugin = Loader::create 'http://twitpic.com/8rfe1u'
# assert_match(%r{^http://s3\.amazonaws\.com/twitpic/photos/full/}, plugin.url)
- plugin = Loader::create 'http://twitpic.com/5lg4ai/full'
+ plugin = Loader::create 'http://twitpic.com/8rfe1u/full'
# assert_match(%r{^http://s3\.amazonaws\.com/twitpic/photos/full/}, plugin.url)
# (deactivated for now, the url is unpredictable)
- test_remote_file plugin.url
+ assert_equal(plugin.title, "Hey #Piraten, Club Mate war gestern, heute ist... - via @kungler")
+
+ #test_remote_file plugin.url
end
def test_vimeo
plugin = Loader::create 'http://vimeo.com/26134306'
assert_equal(plugin.title, "Eclectic Method - The Dark Side")
assert_match(plugin.embed, %r{<iframe src="http://player.vimeo.com})
- assert(plugin.tags.include?("star wars"),
- "tags not scraped correctly? #{plugin.tags.inspect}")
end
def test_xkcd
Please sign in to comment.
Something went wrong with that request. Please try again.