Skip to content

fix: replace anidb with hianime provider - #1897

Open
U-L-M-S wants to merge 8 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 8 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

@madeline-celeste

madeline-celeste commented Sep 9, 2026

Copy link
Copy Markdown

people used to write code 🥹

@port19x

port19x commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator
image

@port19x port19x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-code bumps to the new links are good with one exception.
As for the code, season handling is an artifact of an anidb idiosyncracy.
I'll look into a principled solution to it.

Comment thread ani-cli.1 Outdated

@port19x port19x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the code is in impressively good shape for a model.
Respect to both the prompting @U-L-M-S and on the timing, we get fable 5.1 pre-lobotomy (/pre-quantization) here.
This might be the first time I actually largely like the comments on AI code.

I did read all changes and will give it another pass later today.
I'll also let astra have a look now, though apparently it got nerfed last night so might not be high quality what it tells me.

Comment thread ani-cli
@port19x

port19x commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

@U-L-M-S / @claude Android referrer support was introduced / documented in #1704 and removed in #1830.
Should be easy to get back with those two as context.
As for iOS, this may be a regression we have to accept for this version.
@CoolnsX had sth to say on it in 2025: link

port19x and others added 5 commits September 11, 2026 11:34
@U-L-M-S
U-L-M-S requested a review from port19x September 11, 2026 10:21

@port19x port19x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get Android to work before a merge?
I gave some pointers above

@port19x

port19x commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

@U-L-M-S I'll be hands off during my lunch break now, you're clear to have at it with fable again

@U-L-M-S

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

Copy link
Copy Markdown
Author

Can we get Android to work before a merge? I gave some pointers above

It seens possible. I would like to test it first to be 100% sure.
But I'm not home yet... at 19:00 (MESZ) I'll be home and so I can test everything to be 100% sure.

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