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

streamlink.exceptions.StreamError: #19

Closed
OneClickPablo123 opened this issue Oct 13, 2021 · 5 comments
Closed

streamlink.exceptions.StreamError: #19

OneClickPablo123 opened this issue Oct 13, 2021 · 5 comments

Comments

@OneClickPablo123
Copy link

Hi, at some point the Bot gives me this Error:

info:root:Adding new valid clip: Clip zum Tot by MontanaBlack88
info:root:Status Code: 200 -> handling response data now
info:root:New pagination: eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6Ik5EQXcifX0
Traceback (most recent call last):
File "/home/pablo/.cache/pypoetry/virtualenvs/twitchcompilationcreator-_qx3GjyT-py3.8/lib/python3.8/site-packages/streamlink/plugin/api/http_session.py", line 160, in request
res.raise_for_status()
File "/home/pablo/.cache/pypoetry/virtualenvs/twitchcompilationcreator-_qx3GjyT-py3.8/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: for url: https://production.assets.clips.twitchcdn.net/AT-cm%7ClhUD7Y13uOHAD7xBG7Azew.mp4?sig=03c8ef4078b909a526520055f3aea26a813f2e24&token=%7B%22authorization%22%3A%7B%22forbidden%22%3Atrue%2C%22reason%22%3A%22GEOBLOCKED%22%7D%2C%22clip_uri%22%3A%22https%3A%2F%2Fproduction.assets.clips.twitchcdn.net%2FAT-cm%257ClhUD7Y13uOHAD7xBG7Azew.mp4%22%2C%22device_id%22%3Anull%2C%22expires%22%3A1634224325%2C%22user_id%22%3A%22%22%2C%22version%22%3A2%7D

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 17, in
ch.get_clips(
File "/home/pablo/Schreibtisch/Twitch/TwitchCompilationCreator/src/ClipHandler.py", line 46, in get_clips
self.get_game_clips(utils.get_headers(), timespan, language, kwargs)
File "/home/pablo/Schreibtisch/Twitch/TwitchCompilationCreator/src/ClipHandler.py", line 78, in get_game_clips
self.handle_response_data(resp.json(), language, creator_counts, filter_information)
File "/home/pablo/Schreibtisch/Twitch/TwitchCompilationCreator/src/ClipHandler.py", line 123, in handle_response_data
clip_path = self.download_clip(clip)
File "/home/pablo/Schreibtisch/Twitch/TwitchCompilationCreator/src/ClipHandler.py", line 155, in download_clip
with open(output_file, "wb") as f, stream.open() as fd:
File "/home/pablo/.cache/pypoetry/virtualenvs/twitchcompilationcreator-_qx3GjyT-py3.8/lib/python3.8/site-packages/streamlink/stream/http.py", line 70, in open
res = self.session.http.request(method=method,
File "/home/pablo/.cache/pypoetry/virtualenvs/twitchcompilationcreator-_qx3GjyT-py3.8/lib/python3.8/site-packages/streamlink/plugin/api/http_session.py", line 168, in request
raise err
streamlink.exceptions.StreamError: Unable to open URL: https://production.assets.clips.twitchcdn.net/AT-cm%7ClhUD7Y13uOHAD7xBG7Azew.mp4?sig=03c8ef4078b909a526520055f3aea26a813f2e24&token=%7B%22authorization%22%3A%7B%22forbidden%22%3Atrue%2C%22reason%22%3A%22GEOBLOCKED%22%7D%2C%22clip_uri%22%3A%22https%3A%2F%2Fproduction.assets.clips.twitchcdn.net%2FAT-cm%257ClhUD7Y13uOHAD7xBG7Azew.mp4%22%2C%22device_id%22%3Anull%2C%22expires%22%3A1634224325%2C%22user_id%22%3A%22%22%2C%22version%22%3A2%7D (404 Client Error: for url: https://production.assets.clips.twitchcdn.net/AT-cm%7ClhUD7Y13uOHAD7xBG7Azew.mp4?sig=03c8ef4078b909a526520055f3aea26a813f2e24&token=%7B%22authorization%22%3A%7B%22forbidden%22%3Atrue%2C%22reason%22%3A%22GEOBLOCKED%22%7D%2C%22clip_uri%22%3A%22https%3A%2F%2Fproduction.assets.clips.twitchcdn.net%2FAT-cm%257ClhUD7Y13uOHAD7xBG7Azew.mp4%22%2C%22device_id%22%3Anull%2C%22expires%22%3A1634224325%2C%22user_id%22%3A%22%22%2C%22version%22%3A2%7D)

Can some one Help me out with this?

Greetings

@lucaSchilling
Copy link
Member

Hey, from what I see it looks like the url is either invalid or the clip got deleted. Was this the only clip that had this problem? If this is the case the easiest fix would be to wrap the line where this error happens into a try-except block. If this specific clip is not important just pass in the except block then it should just skip the clips where this problem is occuring. If this is happening to all clips maybe give me some more information which run parameters did you use so I can try it myself

@OneClickPablo123
Copy link
Author

Thanks for your fast reply !
yeah it’s the only clip it’s happening.

So you mean I should edit the http_session.py and add an except for invalid urls ?

@lucaSchilling
Copy link
Member

No I would do it here
home/pablo/Schreibtisch/Twitch/TwitchCompilationCreator/src/ClipHandler.py", line 155, in download_clip with open(output_file, "wb") as f, stream.open() as fd:

Wrap it around that whole with open block(line 155-160). I wouldnt change anything in the http_session.py because that from an external library

@OneClickPablo123
Copy link
Author

Thanks 🙏🏻 i will try it and give feedback !

@MorMundHS-MA
Copy link
Member

Closing due to inactivity. Feel free to comment if the issue persisted.

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

3 participants