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

plugins.openrectv: fix 401 error #5291

Merged
merged 3 commits into from Apr 16, 2023

Conversation

vinyl-umbrella
Copy link
Contributor

OPENREC.tv recently made a small change.
When fetching m3u8, it now returns 401 if "https://www.openrec.tv" is not specified in the referer.
So I avoid that error by adding a referer.

@@ -149,6 +149,7 @@ def _get_streams(self):
log.error("There is no video file.")

if m3u8_file is not None:
self.session.http.headers.update({"Referer": "https://www.openrec.tv/"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to use self.url instead, so the plugin doesn't rely on a hardcoded string literal.

And as an alternative to setting the header on the entire http session, headers={...} could be set as a keyword on the parse_variant_playlist() call.

@bastimeyer bastimeyer added plugin issue A Plugin does not work correctly PR: needs commit message fix labels Apr 16, 2023
@vinyl-umbrella
Copy link
Contributor Author

Thank you for the review and suggestions.

@bastimeyer bastimeyer merged commit e9f9089 into streamlink:master Apr 16, 2023
23 checks passed
@bastimeyer
Copy link
Member

Thanks

@vinyl-umbrella vinyl-umbrella deleted the fix-openrectv branch April 16, 2023 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly PR: needs commit message fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants