fix bug with source::site
This commit is contained in:
@@ -6,7 +6,7 @@ div.list-of-forum-posts {
|
||||
}
|
||||
|
||||
article {
|
||||
border: 1px solid #999;
|
||||
border: 1px solid #AAA;
|
||||
margin: 1em 0em;
|
||||
word-wrap: break-word;
|
||||
box-shadow: 1px 1px 2px #AAA;
|
||||
|
||||
@@ -18,7 +18,6 @@ module Downloads
|
||||
protected
|
||||
def rewrite_html_url(url, headers)
|
||||
return [url, headers] unless Sources::Strategies::ArtStation.url_match?(url)
|
||||
|
||||
source = Sources::Site.new(url)
|
||||
source.get
|
||||
[source.image_url, headers]
|
||||
|
||||
@@ -17,16 +17,14 @@ module Sources
|
||||
end
|
||||
|
||||
def initialize(url, referer_url: nil)
|
||||
@url = url
|
||||
|
||||
Site.strategies.each do |strategy|
|
||||
if strategy.url_match?(url) || strategy.url_match?(referer_url)
|
||||
@strategy = strategy.new(url, referer_url)
|
||||
break
|
||||
return
|
||||
end
|
||||
|
||||
raise NoStrategyError.new
|
||||
end
|
||||
|
||||
raise NoStrategyError.new
|
||||
end
|
||||
|
||||
def referer_url
|
||||
|
||||
@@ -6,9 +6,9 @@ module Sources::Strategies
|
||||
self.project_id(url).present?
|
||||
end
|
||||
|
||||
# https://www.artstation.com/artwork/04XA4"
|
||||
# https://dantewontdie.artstation.com/projects/YZK5q"
|
||||
# https://www.artstation.com/artwork/cody-from-sf"
|
||||
# https://www.artstation.com/artwork/04XA4
|
||||
# https://dantewontdie.artstation.com/projects/YZK5q
|
||||
# https://www.artstation.com/artwork/cody-from-sf
|
||||
def self.project_id(url)
|
||||
if url =~ %r!\Ahttps?://\w+\.artstation\.com/(?:artwork|projects)/(?<project_id>[a-z0-9-]+)\z!i
|
||||
$~[:project_id]
|
||||
|
||||
Reference in New Issue
Block a user