fix: replace anidb with hianime provider - #1897
Open
U-L-M-S wants to merge 1 commit into
Open
Conversation
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>
U-L-M-S
requested review from
Derisis13,
justchokingaround and
port19x
as code owners
September 6, 2026 22:22
|
gpt pr description |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the offline anidb.app with hianime.at.
Credit
This is built on @Dhairya3391's work in #1894. The reverse engineering is theirs: the hianime endpoints, the HD-1 embed, and the
base64(json XOR "otaku-embed-v1")deobfuscation all come from that PR, and they are credited as co-author on the commit. The external.vtthandling in that thread came from @Tsagar3.What I did was rework it on top of master as a smaller diff, since @port19x said the original was too fat to review by hand, and fix the bugs I hit while testing it.
Bugs fixed relative to #1894
Search returned the "Top 10" sidebar. Those widgets use the same
film-detailmarkup as the results grid, so ~30 unrelated titles were appended to every search, and a nonsense query returned 29 rows, meaningNo results found!could never fire.The subtitle regex picked the last track.
"subtitles":\[[^]]*"src":"..."is greedy. Attack on Titan ep 1 has five tracks, all tagged"lang":"en", and the last is labelled Spanish. One Piece has one track, which is why it tests clean.--skipgot an empty MAL id.ani-skipran beforeget_video_link, andmal_idwas only assigned inside a command substitution, so it never reached the parent shell. hianime pages carry no MyAnimeList link, so the description scraper could not supply it either.History from 5.0.x resolved to a different anime. anidb and hianime ids share the
name-<n>shape, so old entries survived migration and the trailing number was sent to hianime as one of theirs. A history line ofattack-on-titan-1offered "Attack on Titan - episode 6" and played One Piece ep 6, then wrote that back. Every user upgrading from 5.0.x hits this on their first-c.IINA and VLC could not take a subtitle URL. They only worked because #1894 downloads the
.vttlocally first.--sub-filesis a path list mpv splits on:, truncating the URL at its scheme; VLC'ssub-filegoes throughvlc_path2uri(), which rewrites an https URL into afile://path. Fixed by escaping the colons for IINA and using:input-slave=for VLC.CI was red. shellcheck SC2312/SC2086/SC2249 and two shfmt complaints.
Structural changes
hianime_m3u8runs in the parent shell and setslinks,sub_link,mal_idandrefrinstead of printing. That removes both temp files, the sixrm -fsites,replay_sub/replay_sub_fileand the local.vttdownload.refris derived from the embed URL instead of hardcodingzokoanime.videoin ten places.hianime_descis dropped. hianime has no seasons block, so its regex was returning nav links, genres and studios.change_seasonre-searches the current title instead, which returns the real related entries.deobfuscate_blobcannot read, and theX-Requested-Withheader, which neither endpoint needs.Tested
shellcheck and shfmt clean, no awk/wget, exec bit set. Sub, dub,
-rranges,-cand--skipresolve under bash, busybox ash andbash --posix. Headless mpv loads video, audio and the external subtitle track, and gives 403 without the referer.yt-dlp --refererandffmpeg -refererboth download, and both 403 without it.Known limitations
cattand the iSHvlc://handler cannot send a Referer header, so they cannot play from this provider. Same as fix: temp-fix #1894, not fixable in the script.-qmostly falls back to best. README and man page adjusted to say so._http_code=${_response##* }inhianime_curlis quadratic in zsh, and the 1.1 MB episode list makes it take over a minute there. Harmless on any real/bin/sh.Closes #1894 if the maintainers prefer this shape, otherwise happy for it to be cherry-picked there instead.