Skip to content

fix: replace anidb with hianime provider - #1897

Open
U-L-M-S wants to merge 3 commits into
pystardust:masterfrom
U-L-M-S:hianime-improvements
Open

fix: replace anidb with hianime provider#1897
U-L-M-S wants to merge 3 commits into
pystardust:masterfrom
U-L-M-S:hianime-improvements

Conversation

@U-L-M-S

@U-L-M-S U-L-M-S commented Sep 6, 2026

Copy link
Copy Markdown

Swaps the dead anidb.app for hianime.at.

Credit

All the hard part — the hianime endpoints, the HD-1 embed, the XOR deobfuscation — is @Dhairya3391's from #1894. They're co-author on the commit. External .vtt handling was @Tsagar3's idea in that thread.

@port19x said #1894 was too big to review, so i redid it on master as a smaller diff (+82/−62 instead of +191/−58) and fixed what broke while testing.

Bugs I hit and fixed

  • Search also returned the "Top 10" sidebar — same markup, so ~30 junk results every time, and No results found! never fired.
  • Greedy regex picked the last subtitle track. AoT ep 1 has five, all tagged english, last one is Spanish.
  • --skip got an empty MAL id — it was set in a subshell and never made it out.
  • Old 5.0.x history played the wrong anime. The ids look alike, so attack-on-titan-1 offered AoT ep 6 and played One Piece ep 6, then saved that. Every one upgrading hits this on their first -c.
  • IINA and VLC choked on a subtitle URL (mpv splits on :, VLC rewrites it to file://). Fixed with escaped colons and :input-slave=.
  • CI was red.

Cleanup

hianime_m3u8 sets its variables directly instead of printing — no more temp files, no local .vtt, no rm -f scattered arround. refr comes from the embed URL instead of being hardcoded ten times. Dropped hianime_desc (hianime has no seasons block, it was returning genres), the HD-2 fallback and an unused header.

Tested

shellcheck and shfmt clean. Sub, dub, -r, -c, --skip on bash, busybox ash and bash --posix. mpv, yt-dlp and ffmpeg all play, and all 403 without the referer.

Caveats

  • Android intents, catt and iSH cant send a Referer, so they can't use this provider. Same in fix: temp-fix #1894, nothing the script can do.
  • IINA/VLC flags come from reading their source — i don't have a Mac. Would love a confirmation.
  • hianime only serves 1080p, so -q mostly falls back to best. Documented.
  • Pre-existing: ${_response##* } is quadratic in zsh, so the episode list crawls there. Fine on a real /bin/sh.

Closes #1894 if you prefer this shape, otherwise cherry-pick it there.

anidb.app is offline, so scrape hianime.at instead: the search page, the
episode and server list endpoints, the HD-1 embed whose config is
base64(json XOR "otaku-embed-v1"), and finally the master playlist.

Builds on the scraping work in pystardust#1894.

- hianime_m3u8 runs in the parent shell and sets links, sub_link, mal_id
  and refr, so ani-skip now runs after get_video_link with a real mal id
- the stream host rejects playlists without a referer, pass it to mpv,
  iina, vlc, syncplay, yt-dlp and ffmpeg
- subtitles come as a separate vtt, hand it to the players and save it
  next to downloads
- hianime has no season list, so change_season searches the current title
- scope the episode list to the selected slug, otherwise ids left over
  from the previous provider resolve to an unrelated show
- cut the top 10 sidebar out of the search results
- create the temp history file before backup_old_hist appends to it
- bump to 5.1.0 and update readme, man page, disclaimer and hacking notes

Co-authored-by: Dhairya3391 <dhairyaadroja3391@gmail.com>
@madeline-celeste

Copy link
Copy Markdown

gpt pr description

@U-L-M-S

U-L-M-S commented Sep 8, 2026

Copy link
Copy Markdown
Author

gpt pr description

Bro... just trust the process 😉

@port19x

port19x commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

@U-L-M-S gpt code is nice, but I'll be real, I'm not reading the text wall that is the PR description, at that point its easier for me to read the code.
As a rule of thumb, let the machine generate what is for the machine and write yourself what should be read by a human.

To quote Jesus

“Teacher, we know that you are honest and don’t defer to anyone; for you aren’t partial to anyone, but truly teach the way of God. Is it lawful to pay taxes to Caesar, or not? Shall we give, or shall we not give?”

But he, knowing their hypocrisy, said, “Why do you test me? Bring me a denarius, that I may see it.” They brought it, and he asked, “Whose is this image and inscription?” They answered, “Caesar’s.” Jesus said, “Render to Caesar the things that are Caesar’s, and to God the things that are God’s.” They marveled greatly at him.

Mark 12:14–17 (WEB)

@U-L-M-S

U-L-M-S commented Sep 8, 2026

Copy link
Copy Markdown
Author

@U-L-M-S gpt code is nice, but I'll be real, I'm not reading the text wall that is the PR description, at that point its easier for me to read the code. As a rule of thumb, let the machine generate what is for the machine and write yourself what should be read by a human.

To quote Jesus

“Teacher, we know that you are honest and don’t defer to anyone; for you aren’t partial to anyone, but truly teach the way of God. Is it lawful to pay taxes to Caesar, or not? Shall we give, or shall we not give?”
But he, knowing their hypocrisy, said, “Why do you test me? Bring me a denarius, that I may see it.” They brought it, and he asked, “Whose is this image and inscription?” They answered, “Caesar’s.” Jesus said, “Render to Caesar the things that are Caesar’s, and to God the things that are God’s.” They marveled greatly at him.
Mark 12:14–17 (WEB)

I rewriten the PR myself I hope it's cleaerer / better to read now.

I used Fable 5.1 btw fro the changes

@WindowsOmega

Copy link
Copy Markdown

With "HD-1" set in line 213, it results in No sources found for sub! (#1893). Set it to "ZokoAnime" to fix it.

hianime reassigned the HD-1 label to a megaplay embed the deobfuscator cannot read, which made sub and dub both fail with no sources found.
The site lists several languages and marks the english one as default, so select by that flag instead of taking the first entry; the docs also lose the single-1080p claim now that episodes serve several resolutions.
@U-L-M-S

U-L-M-S commented Sep 8, 2026

Copy link
Copy Markdown
Author

With "HD-1" set in line 213, it results in No sources found for sub! (#1893). Set it to "ZokoAnime" to fix it.

Good catch ! Thanks ;) hianime moved "HD-1" to a different player. I siwtched it to ZokoAnime

@port19x

port19x commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Thx @U-L-M-S,
juicy Fable 5.1 credits being spent here, I'm more of a GPT-6 guy this month

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants