Prefer the English caption track (label-based, not first-track)
hianime's subtitle 'lang' field is useless (everything says 'en'); the real language is the label, and it is not always first — Chainsaw Man E1 leads with Arabic. Pick label=='English', fall back to first track.
This commit is contained in:
1 parent
5b8170ece0
commit
65da3e848f
1 file changed
+7
-2
@@ -109,8 +109,13 @@ def _master_m3u8(ep_id, lang="eng"):
|
|||||||
hosts.add(urlparse(urljoin(master, line)).netloc)
|
hosts.add(urlparse(urljoin(master, line)).netloc)
|
||||||
STREAM_HOSTS |= hosts
|
STREAM_HOSTS |= hosts
|
||||||
subs = j.get("subtitles") or []
|
subs = j.get("subtitles") or []
|
||||||
if subs and (subs[0] or {}).get("src"):
|
# the 'lang' field is useless (everything says 'en'); the real language
|
||||||
SUBS[ep_id] = subs[0]["src"] # first track is the english one
|
# is the label — and it isn't first (Chainsaw Man E1 leads with Arabic)
|
||||||
|
pick = next((x for x in subs if (x or {}).get("label", "").lower() == "english"), None)
|
||||||
|
if not pick and subs:
|
||||||
|
pick = subs[0]
|
||||||
|
if pick and pick.get("src"):
|
||||||
|
SUBS[ep_id] = pick["src"]
|
||||||
return master
|
return master
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user