Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Too many active streams error #428

Closed
whimsee opened this issue May 22, 2024 · 6 comments
Closed

Too many active streams error #428

whimsee opened this issue May 22, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@whimsee
Copy link

whimsee commented May 22, 2024

I love your tool and I've been using it to grab subtitles for my subtitle archiving project. I ran into a new issue with the CR API whenever I download multiple subtitles in a short time. Probably doesn't just apply to my use case so I thought I'd bring it up.

Describe the bug

"An error occurred: TOO_MANY_ACTIVE_STREAMS ({"activeStreams":[{"accountId": [---the rest]" shows up when downloading subs in quick succession. It goes away after a minute or two but it does slow things down when going through entire series.

To Reproduce
Steps / command to reproduce the behavior:

Using your subtitle-only code snippet as an example. I use a modified version of this in my Python script just to standardize the filenames.

curl -o test.ass $(crunchy-cli search --audio ja-JP -o '{{subtitle.locale}} {{subtitle.url}}' https://www.crunchyroll.com/watch/GRDKJZ81Y/alone-and-lonesome | grep 'en-US' | awk '{print $2}')

Do this a couple of times (2-4 times usually) in the terminal and it throws the error. Wait a while and it clears up and you can download again.

Expected behavior
Should download as normal without errors no matter how many times it's done.

Screenshots
If applicable, add screenshots to help explain your problem.

Client (please complete the following information):

  • OS: Windows running WSL Manjaro
  • Version: crunchy-cli 3.6.5 (7d2ae71 2024-05-22)

Additional context
Add any other context about the problem here.

@whimsee whimsee added the bug Something isn't working label May 22, 2024
@ghost
Copy link

ghost commented May 22, 2024

The video token needs to be deauthorized after the mpd got fetched.

Fix:
You need to do a patch fetch on this url with the contentid and videotoken:
https://cr-play-service.prd.crunchyrollsvc.com/v1/token/${content}/${token}/inactive

@whimsee
Copy link
Author

whimsee commented May 22, 2024

Got it. contentid would look like "GRDQPM1ZY", I suppose?

What does the videotoken look like? The error does provide several "token" keys, but they all seem to give {"error":"Unauthorized","reason":"invalid_token"}% when I patch fetch.

@ghost
Copy link

ghost commented May 22, 2024

Yeah sorry, I forgot to provide you the headers:

const headers = { Authorization: 'Bearer ${login.access_token}' }
const response = await fetch('https://cr-play-service.prd.crunchyrollsvc.com/v1/token/${contentid}/${videotoken}/inactive', { method: 'PATCH', headers: headers })

You get the video token when you fetch the playlist
https://cr-play-service.prd.crunchyrollsvc.com/v1/${contentid}/console/switch/play as token

@whimsee
Copy link
Author

whimsee commented May 22, 2024

Thanks! I'll give it a go once I get the chance.

@bytedream
Copy link
Member

I've added logic that should stop this behavior in v3.6.6.
This doesn't fully stop the error from occurring tho. When you already have a stream open, e.g. in the browser or app, and then try to run the command, it might still error because you can only watch a limited number of streams in parallel

@whimsee
Copy link
Author

whimsee commented May 22, 2024

Just tried it and it works. Thanks a lot! Closing.

@whimsee whimsee closed this as completed May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants