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:
@@ -123,6 +123,10 @@ module Source
|
|||||||
parsed_url.article_id || parsed_referer&.article_id
|
parsed_url.article_id || parsed_referer&.article_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def http
|
||||||
|
super.use(:spoof_referrer)
|
||||||
|
end
|
||||||
|
|
||||||
def page
|
def page
|
||||||
return unless page_url.present?
|
return unless page_url.present?
|
||||||
response = http.cache(1.minute).get(page_url)
|
response = http.cache(1.minute).get(page_url)
|
||||||
|
|||||||
Reference in New Issue
Block a user