#2426 refactor to use predetermined referer

This commit is contained in:
Toks
2015-07-05 11:02:01 -04:00
parent 50f28e780a
commit 0a5f1b53ba
5 changed files with 51 additions and 20 deletions

View File

@@ -74,6 +74,11 @@ module Sources
[image_url]
end
# Should be set to a url for sites that prevent hotlinking, or left nil for sites that don't.
def fake_referer
nil
end
protected
def agent
raise NotImplementedError

View File

@@ -6,7 +6,7 @@ module Sources
module Strategies
class Pixiv < Base
attr_reader :zip_url, :ugoira_frame_data, :ugoira_content_type
MONIKER = '(?:[a-zA-Z0-9_-]+)'
TIMESTAMP = '(?:[0-9]{4}/[0-9]{2}/[0-9]{2}/[0-9]{2}/[0-9]{2}/[0-9]{2})'
EXT = "(?:jpg|jpeg|png|gif)"
@@ -35,6 +35,10 @@ module Sources
@pixiv_moniker
end
def fake_referer
"http://www.pixiv.net"
end
def has_artist_commentary?
@artist_commentary_desc.present?
end