Skip to content

Commit

Permalink
Set User-Agent header for mangadex.
Browse files Browse the repository at this point in the history
For context, the cubari proxy is somewhat a "bad actor" anyway, so
setting explicit UA headers seems incorrect to me. However, we should do
this anyway since it was an explicit ask from the MD devs.
  • Loading branch information
funkyhippo committed Jun 5, 2023
1 parent 3abb36f commit 83c9cec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion proxy/sources/mangadex.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
HEADERS_COMMON = {
"Referer": "https://mangadex.org",
"x-requested-with": "cubari",
"User-Agent": "Cubari/1.0",
}


Expand All @@ -35,6 +36,7 @@ def legacy_mapper(series_id):
resp = post_wrapper(
f"https://api.mangadex.org/legacy/mapping",
json={"type": "manga", "ids": [series_id]},
headers=HEADERS_COMMON,
use_proxy=True,
)
if resp.status_code != 200:
Expand Down Expand Up @@ -212,7 +214,7 @@ def md_api_common(self, meta_id):
for group in remaining_groups:
groups_api_url += f"&ids[]={group}"
groups_resp = get_wrapper(
groups_api_url, headers={"x-requested-with": "cubari"}
groups_api_url, headers=HEADERS_COMMON
)
if groups_resp.status_code != 200:
return
Expand Down

0 comments on commit 83c9cec

Please sign in to comment.