3 from .common
import InfoExtractor
10 class PokerGoBaseIE(InfoExtractor
):
11 _NETRC_MACHINE
= 'pokergo'
13 _PROPERTY_ID
= '1dfb3940-7d53-4980-b0b0-f28b369a000d'
15 def _perform_login(self
, username
, password
):
19 PokerGoBaseIE
._AUTH
_TOKEN
= self
._download
_json
(
20 f
'https://subscription.pokergo.com/properties/{self._PROPERTY_ID}/sign-in', None,
21 headers
={'authorization': f'Basic {base64.b64encode(f"{username}
:{password}
".encode()).decode()}'},
22 data=b'')['meta']['token']
23 if not self._AUTH_TOKEN:
24 raise ExtractorError('Unable to get Auth Token.', expected=True)
26 def _real_initialize(self):
27 if not self._AUTH_TOKEN:
28 self.raise_login_required(method='password')
31 class PokerGoIE(PokerGoBaseIE):
32 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/videos/(?P<id>[^&$#/?]+)'
35 'url': 'https://www.pokergo.com/videos/2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
39 'title': 'Poker After Dark | Season 12 (2020) | Cry Me a River | Episode 2',
40 'description': 'md5:c7a8c29556cbfb6eb3c0d5d622251b71',
41 'thumbnail': 'https://cdn.jwplayer.com/v2/media/aVLOxDzY/poster.jpg?width=720',
42 'timestamp': 1608085715,
46 'series': 'poker after dark',
47 'upload_date': '20201216',
48 'season': 'Season 12',
49 'episode': 'Episode 2',
50 'display_id': '2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
52 'params': {'skip_download': True}
55 def _real_extract(self, url):
56 id = self._match_id(url)
57 data_json = self._download_json(f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/videos/{id}', id,
58 headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
59 v_id = data_json['source']
63 'id': image.get('label'),
64 'width': image.get('width'),
65 'height': image.get('height')
66 } for image in data_json.get('images') or [] if image.get('url')]
67 series_json = next(dct for dct in data_json.get('show_tags') or [] if dct.get('video_id') == id) or {}
70 '_type': 'url_transparent',
72 'title': data_json.get('title'),
73 'description': data_json.get('description'),
74 'duration': data_json.get('duration'),
75 'thumbnails': thumbnails,
76 'season_number': series_json.get('season'),
77 'episode_number': series_json.get('episode_number'),
78 'series': try_get(series_json, lambda x: x['tag']['name']),
79 'url': f'https://cdn.jwplayer.com/v2/media/{v_id}'
83 class PokerGoCollectionIE(PokerGoBaseIE):
84 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/collections/(?P<id>[^&$#/?]+)'
87 'url': 'https://www.pokergo.com/collections/19ffe481-5dae-481a-8869-75cc0e3c4700',
88 'playlist_mincount': 13,
90 'id': '19ffe481-5dae-481a-8869-75cc0e3c4700',
94 def _entries(self, id):
95 data_json = self._download_json(f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/collections/{id}?include=entities',
96 id, headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
97 for video in data_json.get('collection_video') or []:
98 video_id = video.get('id')
100 yield self.url_result(
101 f'https://www.pokergo.com/videos/{video_id}',
102 ie=PokerGoIE.ie_key(), video_id=video_id)
104 def _real_extract(self, url):
105 id = self._match_id(url)
106 return self.playlist_result(self._entries(id), playlist_id=id)