-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
geo_countries = [country.upper()] | ||
self._initialize_geo_bypass({ | ||
'countries': geo_countries, | ||
|
@@ -1001,3 +1002,39 @@ class DiscoveryPlusIndiaShowIE(DiscoveryPlusShowBaseIE): | |
_SHOW_STR = 'show' | ||
_INDEX = 4 | ||
_VIDEO_IE = DiscoveryPlusIndiaIE | ||
|
||
|
||
class GlobalCyclingNetworkPlusIE(DiscoveryPlusBaseIE): | ||
_VALID_URL = r'https?://plus\.globalcyclingnetwork\.com/watch/(?P<id>\d+)' | ||
_TESTS = [{ | ||
'url': 'https://plus.globalcyclingnetwork.com/watch/1397691', | ||
'info_dict': { | ||
'id': '1397691', | ||
'ext': 'mp4', | ||
'title': 'The Athertons: Mountain Biking\'s Fastest Family', | ||
'description': 'md5:75a81937fcd8b989eec6083a709cd837', | ||
'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/04/eb9e3026-4849-3001-8281-9356466f0557.png', | ||
'series': 'gcn', | ||
'creator': 'Gcn', | ||
'upload_date': '20210309', | ||
'timestamp': 1615248000, | ||
'duration': 2531.0, | ||
'tags': [], | ||
}, | ||
'skip': 'Subscription required', | ||
'params': {'skip_download': 'm3u8'}, | ||
}] | ||
|
||
_PRODUCT = 'web' | ||
_DISCO_API_PARAMS = { | ||
'disco_host': 'disco-api-prod.globalcyclingnetwork.com', | ||
'realm': 'gcn', | ||
'country': 'us', | ||
} | ||
|
||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
'Authorization': self._get_auth(disco_base, display_id, realm), | ||
}) |
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 fromDiscoveryPlusBaseIE
:yt-dlp/yt_dlp/extractor/dplay.py
Lines 1029 to 1033 in 9c13de0
With the change to
_get_disco_api_info
, the user can use--geo-bypass-country
to set their country param (andDPlayBaseIE
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