Thanks to visit codestin.com
Credit goes to github.com

Skip to content

plugins.openrectv: fix 401 error#5291

Merged
bastimeyer merged 3 commits into
streamlink:masterfrom
jjjsmz:fix-openrectv
Apr 16, 2023
Merged

plugins.openrectv: fix 401 error#5291
bastimeyer merged 3 commits into
streamlink:masterfrom
jjjsmz:fix-openrectv

Conversation

@jjjsmz

@jjjsmz jjjsmz commented Apr 16, 2023

Copy link
Copy Markdown
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.

Comment thread src/streamlink/plugins/openrectv.py Outdated
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
Copy Markdown
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
@jjjsmz

jjjsmz commented Apr 16, 2023

Copy link
Copy Markdown
Contributor Author

Thank you for the review and suggestions.

@bastimeyer bastimeyer merged commit e9f9089 into streamlink:master Apr 16, 2023
@bastimeyer

Copy link
Copy Markdown
Member

Thanks

@jjjsmz jjjsmz 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.

2 participants