crunchy-labs / crunchy-cli

👇 Command-line downloader for Crunchyroll
MIT License
607 stars 62 forks source link

add season_sequence_number to a episode output #430

Open SatoshiMiamoto opened 6 months ago

SatoshiMiamoto commented 6 months ago

When I download anime episodes, some series have very incorrect numbering. Looking at the episode requests on the site

https://www.crunchyroll.com/content/v2/cms/seasons/GY3VWX3MR/episodes

I noticed that there is a property called season_sequence_numberthat would solve this problem. Is it possible to implement this in the episode outputs?

thanks image

bytedream commented 6 months ago

This isn't possible, sadly season_sequence_number does not like you'd expect it, it has nothing to do with the actual season number.

E.g. season 2 of Ancient Magus Bride: image

SatoshiMiamoto commented 6 months ago

Is there a way to catch the season? in the case of Demon Slayer gets too discrepant from reality. Season 1 turns into 53

bytedream commented 6 months ago

From which country did you do the request? I want to look a bit further into the api response for Demon Slayer, but I get no data when using the url you provided; probably caused by geo-locking

SatoshiMiamoto commented 6 months ago

From brazil pt-BR i get the url from the webiste

Elwador commented 6 months ago

i started using the identifier to get the season numbers - at least for now i haven't had any issues with that

SatoshiMiamoto commented 6 months ago

i started using the identifier to get the season numbers - at least for now i haven't had any issues with that

the season_number identifier?

Elwador commented 6 months ago

Every season has an identifier. For example, for the Demon Slayer seasons:

This way, it is relatively easy to get season numbers that are not strange, like 53, even though there are only 5 seasons. It also helps with the One Piece season numbers since I had a lot of duplicates there as well. I have had no problems using this method to get the season numbers, at least for now. Still need to test it more, but I haven't received any complaints that it doesn't work.

bytedream commented 6 months ago

Oh yea I totally forgot about this. When the --experimental-fixes flag is set, the season number from the identifier is used, at least if it can be parsed to a number. Unfortunately the last time when I touched it was 1+ year ago, so it does not work when the identifier is e.g. S2C1, M2 (so basically it can only parse if the season in the identifier is S<number>)

Elwador commented 6 months ago

Yeah, I think M is for movies, and then there is also OVA for some. Maybe there are even more variants; who knows, it is Crunchyroll 😅

SatoshiMiamoto commented 6 months ago

I went to run a test without the flag and it returned correctly; for some reason, it seems they fixed the references internally. Via CLI it is now correct, but looking at the request directly from the site, it's still showing the value 53. I'm not exactly sure what happened, but I will start using the flag --experimental-fixes.

image image

SatoshiMiamoto commented 6 months ago

I discovered the problem, but I don't know the cause. When I use the flag --audio ja-JP in the search, it returns the values with the incorrect season.

./crunchy-cli search --output "{{series.title}} {{season.number}} {{episode.number}} {{episode.sequence_number}} {{episode.id}} {{episode.title}}" https://www.crunchyroll.com/series/GY5P48XEY/demon-slayer-kimetsu-no-yaiba --audio ja-JP

image

However, when I don't specify the audio flag, it shows the seasons correctly.

 ./crunchy-cli search  --output "{{series.title}} {{season.number}} {{episode.number}} {{episode.sequence_number}} {{episode.id}} {{episode
.title}}"  https://www.crunchyroll.com/series/GY5P48XEY/demon-slayer-kimetsu-no-yaiba

image