77
88
99
10- def get_playback_url (video_id : str , bearer_token : str , get_dash = False ) -> str :
10+ def get_playback_url (video_id : str , bearer_token : str , get_dash : bool , channel : str = "" ) -> str :
1111 """
1212 Get the playback URL (HLS or DASH) for a given video ID.
1313
1414 Parameters:
1515 - video_id (str): ID of the video.
1616 """
1717 headers = {
18- 'authorization' : f'Bearer { bearer_token } ' ,
18+ 'authorization' : f'Bearer { bearer_token [ channel ][ 'key' ] } ' ,
1919 'user-agent' : get_userAgent ()
2020 }
2121
2222 json_data = {
23+ 'deviceInfo' : {
24+ "adBlocker" : False ,
25+ "drmSupported" : True
26+ },
2327 'videoId' : video_id ,
2428 }
2529
26- response = create_client ().post ('https://public.aurora.enhanced.live/playback/v3/videoPlaybackInfo' , headers = headers , json = json_data )
30+ response = create_client ().post (bearer_token [ channel ][ 'endpoint' ] , headers = headers , json = json_data )
2731
2832 if not get_dash :
2933 return response .json ()['data' ]['attributes' ]['streaming' ][0 ]['url' ]
@@ -39,6 +43,13 @@ def get_bearer_token():
3943 str: Token Bearer
4044 """
4145 response = create_client (headers = get_headers ()).get ('https://public.aurora.enhanced.live/site/page/homepage/?include=default&filter[environment]=realtime&v=2' )
42-
43- # response.json()['userMeta']['realm']['X-REALM-DPLAY']
44- return response .json ()['userMeta' ]['realm' ]['X-REALM-IT' ]
46+ return {
47+ 'X-REALM-IT' : {
48+ 'endpoint' : 'https://public.aurora.enhanced.live/playback/v3/videoPlaybackInfo' ,
49+ 'key' : response .json ()['userMeta' ]['realm' ]['X-REALM-IT' ]
50+ },
51+ 'X-REALM-DPLAY' : {
52+ 'endpoint' : 'https://eu1-prod.disco-api.com/playback/v3/videoPlaybackInfo' ,
53+ 'key' : response .json ()['userMeta' ]['realm' ]['X-REALM-DPLAY' ]
54+ }
55+ }
0 commit comments