pystardust / ani-cli

A cli tool to browse and play anime
GNU General Public License v3.0
7.86k stars 540 forks source link

Some episodes wont start playing in mpv #202

Closed chbo70 closed 2 years ago

chbo70 commented 2 years ago

HI, so my main issue is about Black Clover (TV) episodes. After selecting the episode the Player wont start, however i tried it with different animes and they work just fine.

i tried replacing the select video quality print function in issue #192

but it seems its just this anime...

maybe someone can help me or tell me if they have the same issue thanks

Duoslow commented 2 years ago

i have same issue at "senpai ga uzai kouhai no hanashi"

GetDeleted20454 commented 2 years ago

same problem

GetDeleted20454 commented 2 years ago

I tried reinstalling ani-cli and reinstalling the dependincies still doesnt work

alt-art commented 2 years ago

I am getting this error when I try to watch One Piece, I tried to do a debug, but as I know little about shell script, it didn't work.

When I tried to download, I realize what is the error: image

When I remove the dot in the final of URL, he can get the right m3u file.

https://www16.anicdn.stream/astream/c751bab1939a2b83020565e1ac242896/one-piece-episode-1004.1639880060..m3u8 to https://www16.anicdn.stream/astream/c751bab1939a2b83020565e1ac242896/one-piece-episode-1004.1639880060.m3u8

I don't know much about shell scripting, but the error seems to be in get_links line 129.

alt-art commented 2 years ago

I think he couldn't find the quality of the video.

alt-art commented 2 years ago

I will try to make a condition to this at least.

alt-art commented 2 years ago

I changed the line 129 with this:

    # Replace the video with highest quality video
    if [ -z "$video_quality" ];
     then printf '%s' "$video_url";
         else printf '%s' "$video_url" | sed -n -E "s/(.*)\.m3u8/\1.$video_quality.m3u8/p";
    fi

Now Black Cover and One Piece works, but some animes may not work yet.

chbo70 commented 2 years ago

i did replace it however black clover still doesnt work

chbo70 commented 2 years ago

well, if i am precise, the first episode works but without sound, all the episodes after that still don't work

chbo70 commented 2 years ago

Here is my debug.log

alt-art commented 2 years ago

There's still an error that I haven't identified yet, I don't think I'll have time to debug this year.

chbo70 commented 2 years ago

There's still an error that I haven't identified yet, I don't think I'll have time to debug this year.

Bro no worries, already thankful for everything ;)

Stepan-Savchuk commented 2 years ago

I changed the line 129 with this:

    # Replace the video with highest quality video
    if [ -z "$video_quality" ];
       then printf '%s' "$video_url";
         else printf '%s' "$video_url" | sed -n -E "s/(.*)\.m3u8/\1.$video_quality.m3u8/p";
    fi

Now Black Cover and One Piece works, but some animes may not work yet.

It helped me to watch One Piece. Thanks a lot )

wh1ter4bb1t-js commented 2 years ago

I looked a little into this issue; it seems like, for at least some of the anime, gogoanime is pointing their videos to a streamsb server. From there, the current script cannot produce a valid href in the get_links function. I have tried looking into getting around this but not getting anywhere. Hopefully, someone with a little more understanding of this can either give advice or solve this themselves with this knowledge in hand.

seeing this issue with at least the following anime: "senpai ga uzai kouhai no hanashi" "mieruko-chan"

alt-art commented 2 years ago

@wh1ter4bb1t-js We are in trouble, steamsb won't let us scrap the video.

I tried an answer on stack overflow, and it still had more walls.

I have a temporary suggestion for this problem, animes that can't find a link will run the xdg-open command with an embedded_video_url.

wh1ter4bb1t-js commented 2 years ago

@alt-art I don't mind having a temporary solution like that, in fact, I thought of doing the same thing. My main concern is that I think that gogoanime is offloading all of their stuff on these third-party servers and with the number of issues that seem to be open that all are related to this issue. I think streamsb may become the defacto server that is being used and if we have to xdg-open for every video then there is really no point in using ani-cli.

alt-art commented 2 years ago

@wh1ter4bb1t-js True, maybe we can scrape another site, but as we don't have control over it maybe will end up anyway.

Anyway, I like this complicated stuff, and one day I'm going to scrape a site that doesn't usually have many updates (e.g. Crunchyroll).

GarkGarcia commented 2 years ago

I encountered the same bug while trying to watch Cowboy Bebop. It looks like get_links is returning an empty string because the function fails to scrap the video url. In fact, the video url is hidden inside an iframe, and even that only shows up after some javascript inserts the actual video element in the page (it isn't present in the HTML document itself).

port19x commented 2 years ago

Leaving this open, if someone wants to go wild on the regex stuff, feel invited

SaiCral commented 2 years ago

I found some workaround, though I am not entirely familiar on regex but it works on some anime

I added this line after line 262 and before the assignment of video_url

    if [ "$episode_id" = "" ]; then
        episode_id=$(echo "$embedded_video_url" | grep -oP "id.+?&") 
    fi;
    video_url="https://gogoplay1.com/download?${episode_id}"
lorenzoprincipi commented 2 years ago

I made some investigation.

@chbo70

HI, so my main issue is about Black Clover (TV) episodes. After selecting the episode the Player wont start, however i tried it with different animes and they work just fine.

i tried replacing the select video quality print function in issue #192

but it seems its just this anime...

maybe someone can help me or tell me if they have the same issue thanks

I found that, other than vidstreamingcdn, a different mirror has been used to host Black Clover episodes: lb.loadfast1. The workaround is to replace line 265 with:

play_link=$(curl -s $video_url | grep -Eo "(http|https):\/\/(vidstreamingcdn.com|lb.loadfast1.com).*expiry=[0-9]*"| sort -u | sed 's/amp;//' | tail -n 1)

Of course, this is a temporary fix. It might be useful to enumerate all the different hosting URLs used by gogoanime.


@Duoslow

i have same issue at "senpai ga uzai kouhai no hanashi"

In this case the culprit lies on the current RegEx parsing to obtain the _episodeid string. What we want is to catch everything contained between the id= and &token substrings contained in the _embedded_videolink. To do so, replace line 262 and 263 with:

episode_id=$(echo "$embedded_video_url" | sed 's/.*id=\(.*\)&token.*/\1/') video_url="https://gogoplay1.com/download?id={$episode_id}"

The solution proposed by @SaiCral will not work in platforms with grep non supporting Perl-compatible regular expressions (PCRE) (like OS X).

kinglouisph commented 2 years ago

its not fixed by #232

On some episodes it works, like Serial Experiments Lain, but on others like Dr. Stone, it just prints: "\033[1;32m\nVideo played"

and then does nothing

edit: It prints the weird text even when it works

port19x commented 2 years ago

Yes, the PR doesn't fix it at least not in the current state. Like before, one piece works while flcl progressive doesn't

port19x commented 2 years ago

I made some investigation.

@chbo70

HI, so my main issue is about Black Clover (TV) episodes. After selecting the episode the Player wont start, however i tried it with different animes and they work just fine. i tried replacing the select video quality print function in issue #192 but it seems its just this anime... maybe someone can help me or tell me if they have the same issue thanks

I found that, other than vidstreamingcdn, a different mirror has been used to host Black Clover episodes: lb.loadfast1. The workaround is to replace line 265 with:

play_link=$(curl -s $video_url | grep -Eo "(http|https):\/\/(vidstreamingcdn.com|lb.loadfast1.com).*expiry=[0-9]*"| sort -u | sed 's/amp;//' | tail -n 1)

Of course, this is a temporary fix. It might be useful to enumerate all the different hosting URLs used by gogoanime.

@Duoslow

i have same issue at "senpai ga uzai kouhai no hanashi"

In this case the culprit lies on the current RegEx parsing to obtain the _episodeid string. What we want is to catch everything contained between the id= and &token substrings contained in the _embedded_videolink. To do so, replace line 262 and 263 with:

episode_id=$(echo "$embedded_video_url" | sed 's/.*id=\(.*\)&token.*/\1/') video_url="https://gogoplay1.com/download?id={$episode_id}"

The solution proposed by @SaiCral will not work in platforms with grep non supporting Perl-compatible regular expressions (PCRE) (like OS X).

I'd rather not have the different urls enumerated. Instead, a -u url option should be implemented as part of #228

port19x commented 2 years ago

Fix #232 works now. Confirmed with all anime mentioned in this thread. Will merge soon