Skip to content

Conversation

@BellezaEmporium
Copy link
Contributor

@BellezaEmporium BellezaEmporium commented May 30, 2022

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.


@pluginmatcher(re.compile(
r"https?://(?:www\.)?livestream\.com/"
r"https?://(?:www\.|api\.new\.)?livestream\.com/"
Copy link
Member

@bastimeyer bastimeyer May 30, 2022

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.

Copy link
Contributor Author

@BellezaEmporium BellezaEmporium May 30, 2022

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.

@bastimeyer bastimeyer added the plugin enhancement A new feature for a working Plugin label May 30, 2022
@bastimeyer bastimeyer changed the title livestream : Scrape from API for hidden channels plugins.livestream: query API for hidden channels May 30, 2022
@BellezaEmporium BellezaEmporium marked this pull request as draft June 1, 2022 12:09
@BellezaEmporium
Copy link
Contributor Author

Putting it as draft for the moment. Will work on it this weekend, thank you for your patience.

@mkbloke mkbloke added the awaiting response Waiting for a response label Jul 1, 2022
@BellezaEmporium
Copy link
Contributor Author

BellezaEmporium commented Jul 25, 2022

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.

@BellezaEmporium BellezaEmporium marked this pull request as ready for review July 25, 2022 17:01
@mkbloke mkbloke removed the awaiting response Waiting for a response label Jul 25, 2022
@BellezaEmporium BellezaEmporium deleted the patch-2 branch July 26, 2022 12:35
@BellezaEmporium
Copy link
Contributor Author

Thank you for the rewrite @bastimeyer and for the positive outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin enhancement A new feature for a working Plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants