nijie: take artist id from url when possible (#3919)
Fixes the artist finder to work on Nijie posts that have been deleted.
This commit is contained in:
@@ -79,15 +79,8 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def profile_url
|
def profile_url
|
||||||
return url if url =~ PROFILE
|
return nil if artist_id.blank?
|
||||||
|
"https://nijie.info/members.php?id=#{artist_id}"
|
||||||
links = page.search("a.name")
|
|
||||||
|
|
||||||
if links.any?
|
|
||||||
return "https://nijie.info/" + links[0]["href"]
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist_name
|
def artist_name
|
||||||
@@ -113,8 +106,7 @@ module Sources
|
|||||||
end
|
end
|
||||||
|
|
||||||
def unique_id
|
def unique_id
|
||||||
profile_url =~ /nijie\.info\/members.php\?id=(\d+)/
|
"nijie" + artist_id.to_s
|
||||||
"nijie" + $1.to_s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
public
|
public
|
||||||
@@ -132,6 +124,18 @@ module Sources
|
|||||||
urls.map { |url| url[PAGE_URL, :illust_id] || url[IMAGE_URL, :illust_id] }.compact.first
|
urls.map { |url| url[PAGE_URL, :illust_id] || url[IMAGE_URL, :illust_id] }.compact.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def artist_id_from_url
|
||||||
|
urls.map { |url| url[IMAGE_URL, :artist_id] || url[PROFILE_URL, :artist_id] }.compact.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def artist_id_from_page
|
||||||
|
page&.search("a.name")&.first&.attr("href")&.match(/members\.php\?id=(\d+)/) { $1.to_i }
|
||||||
|
end
|
||||||
|
|
||||||
|
def artist_id
|
||||||
|
artist_id_from_url || artist_id_from_page
|
||||||
|
end
|
||||||
|
|
||||||
def page
|
def page
|
||||||
return nil if page_url.blank?
|
return nil if page_url.blank?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user