sources: add image_url?, page_url?, and profile_url? methods.
Add methods to Source::URL for determining whether a URL is an image URL, a page URL, or a profile URL. Also add more source URL tests and fix various URL parsing bugs.
This commit is contained in:
@@ -157,6 +157,10 @@ module Source
|
||||
end
|
||||
end
|
||||
|
||||
def image_url?
|
||||
host.in?(%w[lohas.nicoseiga.jp dcdn.cdn.nimg.jp drm.cdn.nicomanga.jp]) || (host == "seiga.nicovideo.jp" && path.starts_with?("/image/"))
|
||||
end
|
||||
|
||||
def page_url
|
||||
if illust_id.present?
|
||||
"https://seiga.nicovideo.jp/seiga/im#{illust_id}"
|
||||
|
||||
Reference in New Issue
Block a user