Kill trailing whitespace in ruby files
This commit is contained in:
@@ -4,7 +4,7 @@ module Sources
|
||||
def self.url_match?(url)
|
||||
url =~ /^https?:\/\/(?:\w+\.)?pixiv\.net/
|
||||
end
|
||||
|
||||
|
||||
def referer_url(template)
|
||||
if template.params[:ref] =~ /pixiv\.net\/member_illust/ && template.params[:ref] !~ /mode=manga/
|
||||
template.params[:ref]
|
||||
@@ -12,16 +12,16 @@ module Sources
|
||||
template.params[:url]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def site_name
|
||||
"Pixiv"
|
||||
end
|
||||
|
||||
|
||||
def unique_id
|
||||
image_url =~ /\/img\/([^\/]+)/
|
||||
$1
|
||||
end
|
||||
|
||||
|
||||
def get
|
||||
agent.get(URI.parse(normalized_url).request_uri) do |page|
|
||||
@artist_name, @profile_url = get_profile_from_page(page)
|
||||
@@ -31,13 +31,13 @@ module Sources
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
def get_profile_from_page(page)
|
||||
profile_url = page.search("a.user-link").first
|
||||
if profile_url
|
||||
profile_url = "http://www.pixiv.net" + profile_url["href"]
|
||||
end
|
||||
|
||||
|
||||
artist_name = page.search("h1.user").first
|
||||
if artist_name
|
||||
artist_name = artist_name.inner_text
|
||||
@@ -45,7 +45,7 @@ module Sources
|
||||
|
||||
return [artist_name, profile_url]
|
||||
end
|
||||
|
||||
|
||||
def get_image_url_from_page(page)
|
||||
element = page.search("div.works_display a img").first
|
||||
if element
|
||||
@@ -54,10 +54,10 @@ module Sources
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_tags_from_page(page)
|
||||
# puts page.root.to_xhtml
|
||||
|
||||
|
||||
links = page.search("ul.tags a.text").find_all do |node|
|
||||
node["href"] =~ /search\.php/
|
||||
end
|
||||
@@ -70,7 +70,7 @@ module Sources
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def normalized_url
|
||||
@normalized_url ||= begin
|
||||
if url =~ /\/(\d+)(?:_big)?(?:_m|_p\d+)?\.(?:jpg|jpeg|png|gif)/i
|
||||
@@ -84,7 +84,7 @@ module Sources
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def agent
|
||||
@agent ||= begin
|
||||
mech = Mechanize.new
|
||||
|
||||
Reference in New Issue
Block a user