2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class PokerGoBaseIE(InfoExtractor
):
14 _NETRC_MACHINE
= 'pokergo'
16 _PROPERTY_ID
= '1dfb3940-7d53-4980-b0b0-f28b369a000d'
19 username
, password
= self
._get
_login
_info
()
21 self
.raise_login_required(method
='password')
24 PokerGoBaseIE
._AUTH
_TOKEN
= self
._download
_json
(
25 f
'https://subscription.pokergo.com/properties/{self._PROPERTY_ID}/sign-in', None,
26 headers
={'authorization': f'Basic {base64.b64encode(f"{username}
:{password}
".encode()).decode()}'},
27 data=b'')['meta']['token']
28 if not self._AUTH_TOKEN:
29 raise ExtractorError('Unable to get Auth Token.', expected=True)
31 def _real_initialize(self):
32 if not self._AUTH_TOKEN:
36 class PokerGoIE(PokerGoBaseIE):
37 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/videos/(?P<id>[^&$#/?]+)'
40 'url': 'https://www.pokergo.com/videos/2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
44 'title': 'Poker After Dark | Season 12 (2020) | Cry Me a River | Episode 2',
45 'description': 'md5:c7a8c29556cbfb6eb3c0d5d622251b71',
46 'thumbnail': 'https://cdn.jwplayer.com/v2/media/aVLOxDzY/poster.jpg?width=720',
47 'timestamp': 1608085715,
51 'series': 'poker after dark',
52 'upload_date': '20201216',
53 'season': 'Season 12',
54 'episode': 'Episode 2',
55 'display_id': '2a70ec4e-4a80-414b-97ec-725d9b72a7dc',
57 'params': {'skip_download': True}
60 def _real_extract(self, url):
61 id = self._match_id(url)
62 data_json = self._download_json(f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/videos/{id}', id,
63 headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
64 v_id = data_json['source']
68 'id': image.get('label'),
69 'width': image.get('width'),
70 'height': image.get('height')
71 } for image in data_json.get('images') or [] if image.get('url')]
72 series_json = next(dct for dct in data_json.get('show_tags') or [] if dct.get('video_id') == id) or {}
75 '_type': 'url_transparent',
77 'title': data_json.get('title'),
78 'description': data_json.get('description'),
79 'duration': data_json.get('duration'),
80 'thumbnails': thumbnails,
81 'season_number': series_json.get('season'),
82 'episode_number': series_json.get('episode_number'),
83 'series': try_get(series_json, lambda x: x['tag']['name']),
84 'url': f'https://cdn.jwplayer.com/v2/media/{v_id}'
88 class PokerGoCollectionIE(PokerGoBaseIE):
89 _VALID_URL = r'https?://(?:www\.)?pokergo\.com/collections/(?P<id>[^&$#/?]+)'
92 'url': 'https://www.pokergo.com/collections/19ffe481-5dae-481a-8869-75cc0e3c4700',
93 'playlist_mincount': 13,
95 'id': '19ffe481-5dae-481a-8869-75cc0e3c4700',
99 def _entries(self, id):
100 data_json = self._download_json(f'https://api.pokergo.com/v2/properties/{self._PROPERTY_ID}/collections/{id}?include=entities',
101 id, headers={'authorization': f'Bearer {self._AUTH_TOKEN}'})['data']
102 for video in data_json.get('collection_video') or []:
103 video_id = video.get('id')
105 yield self.url_result(
106 f'https://www.pokergo.com/videos/{video_id}',
107 ie=PokerGoIE.ie_key(), video_id=video_id)
109 def _real_extract(self, url):
110 id = self._match_id(url)
111 return self.playlist_result(self._entries(id), playlist_id=id)