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
[extractor/dplay] GlobalCyclingNetworkPlus: Add extractor #7360
Conversation
@@ -65,6 +65,7 @@ def _download_video_playback_info(self, disco_base, video_id, headers): | |||
return streaming_list | |||
|
|||
def _get_disco_api_info(self, url, display_id, disco_host, realm, country, domain=''): | |||
country = self.get_param('geo_bypass_country') or country |
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.
Since this a worldwide site, it doesn't make sense to hardcode a country
, as is required in the _DISCO_API_PARAMS
var for extractors subclassed from DiscoveryPlusBaseIE
:
yt-dlp/yt_dlp/extractor/dplay.py
Lines 1029 to 1033 in 9c13de0
_DISCO_API_PARAMS = { | |
'disco_host': 'disco-api-prod.globalcyclingnetwork.com', | |
'realm': 'gcn', | |
'country': 'us', | |
} |
With the change to _get_disco_api_info
, the user can use --geo-bypass-country
to set their country param (and DPlayBaseIE
also uses this country value for xff anyways).
Letting the user configure the country
param would also partially address problems reported in #2138 and #2361 (though completely resolving those issues is outside the scope of this PR), see:
#2361 (comment)
#2138 (comment)
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.
But the disco_host
may also vary by country (perhaps not in this case)?
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.
it did not vary for this site; that's something we can deal with when the extractor at hand demands it
def _update_disco_api_headers(self, headers, disco_base, display_id, realm): | ||
headers.update({ | ||
'x-disco-params': f'realm={realm}', | ||
'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:27.3.2', |
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.
27.42 has been observed for other D/D+ sites. I wonder if this has any effect. One could guess that eventually the site could exclude a "too old" client, but also might not like a "too new" one.
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.
27.3.2
is what was in the requests my browser was sending
* Allows `country` API param to be configured with `--xff`/`geo_bypass_country` Closes yt-dlp#7324 Authored by: bashonly
Subscription-only site for cycling videos/events. Uses the Discovery+/dplay API.
Closes #7324
Template
Before submitting a pull request make sure you have:
In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:
What is the purpose of your pull request?
Copilot Summary
🤖 Generated by Copilot at 9c13de0
Summary
🚴♂️🔐🌎
Add support for Global Cycling Network Plus videos using the Discovery Plus API. Create a new extractor class
GlobalCyclingNetworkPlusIE
indplay.py
and register it in_extractors.py
.Walkthrough