Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[animepahe] failed to resolve stream_url - kwik redirect url changed #295

Open
Type-Delta opened this issue Dec 23, 2023 · 1 comment
Open

Comments

@Type-Delta
Copy link

So I tried streaming from animepahe today and got this error
ValueError: unknown url type: '/'

this doesn't tell anything. I know, but after some investigation this is what I came up with:
starts from get_animepahe_url() in providers/animepahe/inner/init.py line 48

def get_animepahe_url(session, pahe_win_url):
    response = session.get(pahe_win_url)
    response.raise_for_status()

    url = KWIK_REDIRECTION_RE.search(response.text).group(1)

    download_page = session.get(url)

    ...

the respond from get() request to pahe_win_url has changed
from redirect url being directly in the <a href="">
it's now being set by this script in the <head> after 5 seconds delay.

   let daca = 5;
   let guxesocexe = setInterval(function(){
      $("a.redirect").attr("href","#cito").html(daca + " seconds");
      if (daca < 1) {
         clearInterval(guxesocexe);
         $("a.redirect").attr("href","https://kwik.cx/f/cdNpjSCMtYMw").html("Continue");
      }
      daca--;
   }, 1000);

(Note that: these variable names changed every time)

this made the regex's capture group to capture a single placeholder '#' and puts it in url
because '#' doesn't resolve to any meaningful url, httpx.get() freaks out and throw the mentioned error.

to get a proper redirect url, I've updated the KWIK_REDIRECTION_RE
from <a href="(.+?)" .+?>Redirect me</a>
to ;\$\("a\.redirect"\)\.attr\("href","(.+?)"\)\.html\("Continue"\);

like this:

KWIK_REDIRECTION_RE = regex.compile(r';\$\("a\.redirect"\)\.attr\("href","(.+?)"\)\.html\("Continue"\);')

updating this regex fix the issue for me

PS: sorry if I made any mistakes, I so sleepy lol

@Clashkid155
Copy link

Seems to work, thanks!

shashstormer added a commit to shashstormer/animdl that referenced this issue Jan 1, 2024
a solution was proposed multiple days ago but no one was commiting it to the repo so created this commit based on justfoolingaround#295
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

No branches or pull requests

2 participants