import urllib.request
import urllib.response
import uuid
-from ..utils.networking import clean_proxies
+
from .common import InfoExtractor
from ..aes import aes_ecb_decrypt
from ..utils import (
ExtractorError,
+ OnDemandPagedList,
bytes_to_intlist,
decode_base_n,
int_or_none,
intlist_to_bytes,
- OnDemandPagedList,
time_seconds,
traverse_obj,
update_url_query,
)
+from ..utils.networking import clean_proxies
def add_opener(ydl, handler): # FIXME: Create proper API in .networking
# the protocol that this should really handle is 'abematv-license://'
# abematv_license_open is just a placeholder for development purposes
# ref. https://github.com/python/cpython/blob/f4c03484da59049eb62a9bf7777b963e2267d187/Lib/urllib/request.py#L510
- setattr(self, 'abematv-license_open', getattr(self, 'abematv_license_open'))
+ setattr(self, 'abematv-license_open', getattr(self, 'abematv_license_open', None))
self.ie = ie
def _get_videokey_from_ticket(self, ticket):
query={'t': media_token},
data=json.dumps({
'kv': 'a',
- 'lt': ticket
- }).encode('utf-8'),
+ 'lt': ticket,
+ }).encode(),
headers={
'Content-Type': 'application/json',
})
h = hmac.new(
binascii.unhexlify(self.HKEY),
- (license_response['cid'] + self.ie._DEVICE_ID).encode('utf-8'),
+ (license_response['cid'] + self.ie._DEVICE_ID).encode(),
digestmod=hashlib.sha256)
enckey = bytes_to_intlist(h.digest())
@classmethod
def _generate_aks(cls, deviceid):
- deviceid = deviceid.encode('utf-8')
+ deviceid = deviceid.encode()
# add 1 hour and then drop minute and secs
ts_1hour = int((time_seconds() // 3600 + 1) * 3600)
time_struct = time.gmtime(ts_1hour)
- ts_1hour_str = str(ts_1hour).encode('utf-8')
+ ts_1hour_str = str(ts_1hour).encode()
tmp = None
def mix_tmp(count):
nonlocal tmp
- for i in range(count):
+ for _ in range(count):
mix_once(tmp)
def mix_twist(nonce):
data=json.dumps({
'deviceId': self._DEVICE_ID,
'applicationKeySecret': aks,
- }).encode('utf-8'),
+ }).encode(),
headers={
'Content-Type': 'application/json',
})
'osLang': 'ja_JP',
'osTimezone': 'Asia/Tokyo',
'appId': 'tv.abema',
- 'appVersion': '3.27.1'
+ 'appVersion': '3.27.1',
}, headers={
'Authorization': f'bearer {self._get_device_token()}',
})['token']
f'https://api.abema.io/v1/auth/{ep}', None, note='Logging in',
data=json.dumps({
method: username,
- 'password': password
- }).encode('utf-8'), headers={
+ 'password': password,
+ }).encode(), headers={
'Authorization': f'bearer {self._get_device_token()}',
'Origin': 'https://abema.tv',
'Referer': 'https://abema.tv/',
description = self._html_search_regex(
(r'<p\s+class="com-video-EpisodeDetailsBlock__content"><span\s+class=".+?">(.+?)</span></p><div',
- r'<span\s+class=".+?SlotSummary.+?">(.+?)</span></div><div',),
+ r'<span\s+class=".+?SlotSummary.+?">(.+?)</span></div><div'),
webpage, 'description', default=None, group=1)
if not description:
og_desc = self._html_search_meta(