#1866: Support HTTPS urls
This commit is contained in:
@@ -12,7 +12,7 @@ module Downloads
|
||||
|
||||
protected
|
||||
def rewrite_html_pages(url, headers)
|
||||
if url =~ %r{^http://.+?\.deviantart\.com/art/}
|
||||
if url =~ %r{^https?://.+?\.deviantart\.com/art/}
|
||||
source = ::Sources::Strategies::DeviantArt.new(url)
|
||||
source.get
|
||||
return [source.image_url, headers]
|
||||
@@ -22,10 +22,10 @@ module Downloads
|
||||
end
|
||||
|
||||
def rewrite_thumbnails(url, headers)
|
||||
if url =~ %r{^(http://.+?\.deviantart\.net/.+?/)200H/}
|
||||
if url =~ %r{^(https?://.+?\.deviantart\.net/.+?/)200H/}
|
||||
match = $1
|
||||
url.sub!(match + "200H/", match)
|
||||
elsif url =~ %r{^(http://.+?\.deviantart\.net/.+?/)PRE/}
|
||||
elsif url =~ %r{^(https?://.+?\.deviantart\.net/.+?/)PRE/}
|
||||
match = $1
|
||||
url.sub!(match + "PRE/", match)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ module Downloads
|
||||
module Strategies
|
||||
class Twitpic < Base
|
||||
def rewrite(url, headers)
|
||||
if url =~ %r{http://twitpic\.com} || url =~ %r{^http://d3j5vwomefv46c\.cloudfront\.net}
|
||||
if url =~ %r{https?://twitpic\.com} || url =~ %r{^https?://d3j5vwomefv46c\.cloudfront\.net}
|
||||
url, headers = rewrite_html_pages(url, headers)
|
||||
url, headers = rewrite_thumbnails(url, headers)
|
||||
end
|
||||
@@ -14,7 +14,7 @@ module Downloads
|
||||
def rewrite_html_pages(url, headers)
|
||||
# example: http://twitpic.com/cpprns
|
||||
|
||||
if url =~ %r{http://twitpic\.com/([a-z0-9]+)$}
|
||||
if url =~ %r{https?://twitpic\.com/([a-z0-9]+)$}
|
||||
id = $1
|
||||
url = "http://twitpic.com/show/full/#{id}"
|
||||
return [url, headers]
|
||||
@@ -24,7 +24,7 @@ module Downloads
|
||||
end
|
||||
|
||||
def rewrite_thumbnails(url, headers)
|
||||
if url =~ %r{^http://d3j5vwomefv46c\.cloudfront\.net/photos/thumb/(\d+\..+)$}
|
||||
if url =~ %r{^https?://d3j5vwomefv46c\.cloudfront\.net/photos/thumb/(\d+\..+)$}
|
||||
match = $1
|
||||
url.sub!("/thumb/" + match, "/large/" + match)
|
||||
end
|
||||
|
||||
@@ -58,9 +58,9 @@ module Sources
|
||||
|
||||
def normalized_url
|
||||
@normalized_url ||= begin
|
||||
if url =~ %r{\Ahttp://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-z0-9_]*_by_[a-z0-9_]+-d([a-z0-9]+)\.}i
|
||||
if url =~ %r{\Ahttps?://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-z0-9_]*_by_[a-z0-9_]+-d([a-z0-9]+)\.}i
|
||||
"http://fav.me/d#{$1}"
|
||||
elsif url =~ %r{\Ahttp://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i
|
||||
elsif url =~ %r{\Ahttps?://(?:fc|th)\d{2}\.deviantart\.net/.+/[a-f0-9]+-d([a-z0-9]+)\.}i
|
||||
"http://fav.me/d#{$1}"
|
||||
elsif url =~ %r{deviantart\.com/art/}
|
||||
url
|
||||
|
||||
Reference in New Issue
Block a user