Rewrite tumblr cdn urls

This commit is contained in:
Toks
2014-10-03 14:36:37 -04:00
parent 685d65ffdb
commit 4b9605075b
2 changed files with 11 additions and 2 deletions

View File

@@ -2,7 +2,8 @@ module Downloads
module Strategies
class Tumblr < Base
def rewrite(url, headers)
if url =~ %r{^http?://(?:(?:\d+\.)\w+\.)?tumblr\.com}
if url =~ %r{^https?://.*tumblr\.com}
url, headers = rewrite_cdn(url, headers)
url, headers = rewrite_thumbnails(url, headers)
end
@@ -23,6 +24,14 @@ module Downloads
return [url, headers]
end
def rewrite_cdn(url, headers)
if url =~ %r{https?://gs1\.wac\.edgecastcdn\.net/8019B6/data\.tumblr\.com/}
url.sub!("gs1.wac.edgecastcdn.net/8019B6/", "")
end
return [url, headers]
end
end
end
end

View File

@@ -32,7 +32,7 @@ class Artist < ActiveRecord::Base
url = File.dirname(url) + "/"
break if url =~ /pixiv\.net\/(?:img\/)?$/i
break if url =~ /lohas\.nicoseiga\.jp\/priv\/$/i
break if url =~ /media\.tumblr\.com\/[a-z0-9]+\/$/i
break if url =~ /(?:data|media)\.tumblr\.com\/[a-z0-9]+\/$/i
break if url =~ /deviantart\.net\//i
end