o.twimg.com source redirection
* mainly twitpic, but it's possible there are others * uses base64 and uri ruby modules
This commit is contained in:
@@ -383,6 +383,16 @@ class Post < ActiveRecord::Base
|
|||||||
|
|
||||||
when %r{\Ahttps?://pic0[1-4]\.nijie\.info/nijie_picture/(?:diff/main/)?\d+_(\d+)_(?:\d+{10}|\d+_\d+{14})}i
|
when %r{\Ahttps?://pic0[1-4]\.nijie\.info/nijie_picture/(?:diff/main/)?\d+_(\d+)_(?:\d+{10}|\d+_\d+{14})}i
|
||||||
"http://nijie.info/view.php?id=#{$1}"
|
"http://nijie.info/view.php?id=#{$1}"
|
||||||
|
|
||||||
|
when %r{\Ahttps?://(?:o|image-proxy-origin)\.twimg\.com/\d/proxy\.jpg\?t=(\w+)&}i
|
||||||
|
str = Base64.decode64($1)
|
||||||
|
url = URI.extract(str, ['http', 'https'])
|
||||||
|
if (url[0] =~ /^https?:\/\/twitpic.com\/show\/large\/[a-z0-9]+/i)
|
||||||
|
url[0].gsub!(/show\/large\//, "")
|
||||||
|
index = url[0].rindex('.')
|
||||||
|
url[0] = url[0][0..index-1]
|
||||||
|
end
|
||||||
|
"#{url[0]}"
|
||||||
|
|
||||||
else
|
else
|
||||||
source
|
source
|
||||||
|
|||||||
Reference in New Issue
Block a user