Skip to content

feat: switch provider to Miruro - #1993

Open
Dhairya3391 wants to merge 9 commits into
pystardust:masterfrom
Dhairya3391:miruro-provider
Open

Dhairya3391 wants to merge 9 commits into
pystardust:masterfrom
Dhairya3391:miruro-provider

Conversation

@Dhairya3391

@Dhairya3391 Dhairya3391 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Switch the provider from HiAnime to Miruro.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 17:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Dhairya3391 Dhairya3391 changed the title Switch provider to Miruro feat: switch provider to Miruro Nov 12, 2026

@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.

Keep the carefully crafted http error codes please.
Maybe you can explain with an example why we need slot handling.
Also { # breaks formating, don't do that
miruro_media looks rough

@Dhairya3391
Dhairya3391 requested a review from port19x November 13, 2026 12:55
@Dhairya3391

Dhairya3391 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

@port19x Here is the current flow after the simplification.

The slot parser is gone

The earlier slot/devalue explanation no longer applies. Miruro's HTML pages already contain the same data as plain JS objects (items:[...], tracks:[...], number:), so the provider reads those directly. There is no __data.json, slot table, ID map, slug resolution, roster cache, or parallel source worker in the current code.

Request and playback flow

flowchart TD
    Query["Search query"] --> Search["GET /search?q=... (HTML)"]
    Search --> Items["items:[...]"]
    Items --> ID["anilist:show:mal"]
    ID --> Watch["GET /watch/show/x?ep=1 (HTML)"]
    Watch --> Episodes["number: values -> episode list"]
    Episodes --> Menu["Episode selection"]
    Menu --> Tracks["tracks:[...] for selected episode"]
    Tracks --> Pool["ssub, then sub (or dub)"]
    Pool --> Servers["providers -> servers -> streams"]
    Servers --> Master["HLS master with Referer/Origin"]
    Master --> Variants["RESOLUTION variants"]
    Variants --> Links["quality server > url"]
    Links --> Choice["best or change_quality"]
    Choice --> Player["mpv/IINA: Referer + Origin + forced HLS"]
Loading

Function boundaries

  • miruro_curl: curl wrapper; keeps the HTTP status/transport diagnostics.
  • miruro_search: parses the search HTML into anilist:show:mal<TAB>title.
  • miruro_episodes: parses number: values from the watch HTML.
  • miruro_m3u8: parses the HLS master into labelled quality variants and resolves root-relative playlist URLs against the stream origin.
  • miruro_media: selects ssub/sub (or dub), walks providers to servers to streams, and keeps the first source's Referer, Origin and subtitle URL. Sources with matching headers are joined into the same quality list.
  • select_quality / change_quality: picks the requested/best variant; the menu can switch to any listed source.
  • History keeps anilist:show:mal IDs; old hianime rows are backed up to .v4.

Current state

Pushed as 14ffb76. The change-quality menu lists every usable source with its server label. best starts with the highest variant of the first source. Playback passes the per-source referrer, the required Origin header, and forces the HLS demuxer for extensionless/image/jpeg playlists. Local smoke tests passed for One Piece, FLCL and Naruto (sub, dub, quality, history); this now just needs testing.

@port19x

port19x commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Your last commit went in the wrong direction.
Make sure you give your agent what it needs to thrive by including contributing.md and the ani-cli ci jobs in their context.
Also, and thankfully this isn't a major issue in the PR, please omit most of the code comments.
The only defensible comment is the m3u8 RFC namedrop

@port19x

port19x commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Perhaps the most important exerpt of the guidelines for both you and your agent:

Your likelihood of being merged is inversely proportional to your change size

Right now at +527 -124 there is a zero percent chance I'll merge this

@Dhairya3391

Copy link
Copy Markdown
Contributor Author

Updated the flow comment above and pushed 14ffb76.

The provider now reads Miruro's HTML directly, lists all usable sources in the change-quality menu, and passes the required Origin/HLS flags. Local smoke tests pass for One Piece, FLCL and Naruto (sub, dub, quality, history). This just needs testing now.

Resolve streams from Miruro's HTML pages, pass the Origin header these
hosts require, force the HLS demuxer for extensionless playlists, and
list every usable source in the change-quality menu.

@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.

Respect 💪
First glance impression: +150 -88 is much much better.
We'll see if we can maybe save another 10 lines or if not maybe make some details more elegant, but this is now already within the range of acceptable code.

It also reads closer to previous provider systems, just good old sed and no type 2 slot system.
miruro_media is a little long and a little complicated still, though I'm not sure how much of that is essential complexity modeling how the provider works and how much of it is incidental complexity, purely introduced by implementation.

The most immediate win I see is a bunch of variable="" initializations.
I understand this can be correct when resetting in a loop for example, but please double check which ones are actually just redundant because you have a true assignment at a later point with no risk of collision with a previous value.

In unrelated news I have a cheap android device on its way to play around with so, with some luck, I can do the initial android testing this weekend.

Dhairya3391 and others added 2 commits November 17, 2026 18:34
@Dhairya3391
Dhairya3391 requested a review from port19x November 17, 2026 15:09
- carry referrer, origin, HLS, audio and subtitle URLs per source
- forward audio and subtitle links to all players and downloads
- use | delimiter so empty audio fields don't shift the subtitle URL
- skip forced HLS demuxer when subs are present so they load
- prefer a same-quality source with subs when the chosen one has none
- simplify nth and history tab parsing
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.

Report wrong anime version coming up The first item for (almost) every dubbed anime is subbed. Some episodes don't have a subtitles.

3 participants