bilibili: fix API calls returning HTTP 412.

Fix API calls returning HTTP 412 (Precondition Failed) errors. It seems we need to spoof the Referer as
`https://bilibili.com` for API calls to succeed.
This commit is contained in:
evazion
2022-11-16 22:06:57 -06:00
parent 96e1b6a512
commit 94824fb171

View File

@@ -123,6 +123,10 @@ module Source
parsed_url.article_id || parsed_referer&.article_id
end
def http
super.use(:spoof_referrer)
end
def page
return unless page_url.present?
response = http.cache(1.minute).get(page_url)