-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
plugins.livestream: query API for hidden channels #4557
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
Conversation
src/streamlink/plugins/livestream.py
Outdated
|
|
||
| @pluginmatcher(re.compile( | ||
| r"https?://(?:www\.)?livestream\.com/" | ||
| r"https?://(?:www\.|api\.new\.)?livestream\.com/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
This is not how plugin matchers are supposed to be used. API URLs should not be part of the plugin matcher. If you need to query a site's API, then you need to get the necessary information from the canonical input URL via regex capture groups, or from the contents of the response when requesting the canonical input URL.
I'm not going to comment on the other changes just yet, because those would need to be rewritten anyway in regards to the API querying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see when I have the time to rewrite the whole process with the API as a base URL for scraping, and, on the regex, match anything finishing with livestream.com. I'll most certainly base my work on all the other plugins you've made, containing an API, to make sure the plugin works like all the other implementations.
This could permit to make both API and basic Livestream URLs being read.
I mainly made the change directly when I've seen that API links were the only endpoint for hidden channels.
|
Putting it as draft for the moment. Will work on it this weekend, thank you for your patience. |
|
Sorry for the long time without any answer, I was busy with work and didn't have the time to do anything on this project. Now that I have the time to rewrite it, here's my new proposition. Using the API url will permit you to reduce the work needed to access a link, since it needed a specific regex onto the Livestream page to get the necessary stream_info data. |
|
Thank you for the rewrite @bastimeyer and for the positive outcome. |
Context
In certain cases, the channel is hidden (see : https://api.new.livestream.com/accounts/29565692/events/9321713/), and to make Streamlink work in those kind of links, it needs to be scraped on API links only.
What this PR does
This PR aims to add another way of scraping Livestream channels.
Technical explanation
Using the api.new.livestream.com base API endpoint, it will be possible to get all kinds of links. A condition is put to verify if the stream_info response is available, and another condition is put to verify the nature of given URL (if link is api.new.livestream.com, get JSON and verify if the stream_info part is available. else, contact the API URL available inside the code, and get the stream.)
PR Classification
This would be considered as an improvement, based off the original plugin.