Nicoseiga: Add support for drm-served manga

This commit is contained in:
nonamethanks
2020-06-03 10:39:31 +02:00
parent 260bc997f6
commit 6fc4d3ec44
2 changed files with 6 additions and 8 deletions

View File

@@ -12,7 +12,10 @@ class NicoSeigaApiClient
[api_response["id"]]
elsif @work_type == "manga"
manga_api_response.map do |x|
x["meta"]["source_url"].match(%r{/thumb/(\d+)\w}i).captures[0]
case x["meta"]["source_url"]
when %r{/thumb/(\d+)\w}i then Regexp.last_match(1)
when %r{nicoseiga\.cdn\.nimg\.jp/drm/image/\w+/(\d+)\w}i then Regexp.last_match(1)
end
end
end
end

View File

@@ -84,15 +84,10 @@ module Sources
end
def preview_urls
if manga_id.present?
image_urls.map do |img|
id = image_id_from_url(img)
"https://lohas.nicoseiga.jp/thumb/#{id}p"
end
elsif illust_id.present?
if illust_id.present?
["https://lohas.nicoseiga.jp/thumb/#{illust_id}i"]
else
[]
image_urls
end
end