|
|
@ -156,7 +156,7 @@ class AbemaTVBaseIE(InfoExtractor):
|
|
|
|
def _generate_aks(cls, deviceid):
|
|
|
|
def _generate_aks(cls, deviceid):
|
|
|
|
deviceid = deviceid.encode('utf-8')
|
|
|
|
deviceid = deviceid.encode('utf-8')
|
|
|
|
# add 1 hour and then drop minute and secs
|
|
|
|
# add 1 hour and then drop minute and secs
|
|
|
|
ts_1hour = int((time_seconds(hours=9) // 3600 + 1) * 3600)
|
|
|
|
ts_1hour = int((time_seconds() // 3600 + 1) * 3600)
|
|
|
|
time_struct = time.gmtime(ts_1hour)
|
|
|
|
time_struct = time.gmtime(ts_1hour)
|
|
|
|
ts_1hour_str = str(ts_1hour).encode('utf-8')
|
|
|
|
ts_1hour_str = str(ts_1hour).encode('utf-8')
|
|
|
|
|
|
|
|
|
|
|
@ -190,6 +190,16 @@ class AbemaTVBaseIE(InfoExtractor):
|
|
|
|
if self._USERTOKEN:
|
|
|
|
if self._USERTOKEN:
|
|
|
|
return self._USERTOKEN
|
|
|
|
return self._USERTOKEN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
username, _ = self._get_login_info()
|
|
|
|
|
|
|
|
AbemaTVBaseIE._USERTOKEN = username and self.cache.load(self._NETRC_MACHINE, username)
|
|
|
|
|
|
|
|
if AbemaTVBaseIE._USERTOKEN:
|
|
|
|
|
|
|
|
# try authentication with locally stored token
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
self._get_media_token(True)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
except ExtractorError as e:
|
|
|
|
|
|
|
|
self.report_warning(f'Failed to login with cached user token; obtaining a fresh one ({e})')
|
|
|
|
|
|
|
|
|
|
|
|
AbemaTVBaseIE._DEVICE_ID = str(uuid.uuid4())
|
|
|
|
AbemaTVBaseIE._DEVICE_ID = str(uuid.uuid4())
|
|
|
|
aks = self._generate_aks(self._DEVICE_ID)
|
|
|
|
aks = self._generate_aks(self._DEVICE_ID)
|
|
|
|
user_data = self._download_json(
|
|
|
|
user_data = self._download_json(
|
|
|
@ -300,6 +310,11 @@ class AbemaTVIE(AbemaTVBaseIE):
|
|
|
|
_TIMETABLE = None
|
|
|
|
_TIMETABLE = None
|
|
|
|
|
|
|
|
|
|
|
|
def _perform_login(self, username, password):
|
|
|
|
def _perform_login(self, username, password):
|
|
|
|
|
|
|
|
self._get_device_token()
|
|
|
|
|
|
|
|
if self.cache.load(self._NETRC_MACHINE, username) and self._get_media_token():
|
|
|
|
|
|
|
|
self.write_debug('Skipping logging in')
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
if '@' in username: # don't strictly check if it's email address or not
|
|
|
|
if '@' in username: # don't strictly check if it's email address or not
|
|
|
|
ep, method = 'user/email', 'email'
|
|
|
|
ep, method = 'user/email', 'email'
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -319,6 +334,7 @@ class AbemaTVIE(AbemaTVBaseIE):
|
|
|
|
|
|
|
|
|
|
|
|
AbemaTVBaseIE._USERTOKEN = login_response['token']
|
|
|
|
AbemaTVBaseIE._USERTOKEN = login_response['token']
|
|
|
|
self._get_media_token(True)
|
|
|
|
self._get_media_token(True)
|
|
|
|
|
|
|
|
self.cache.store(self._NETRC_MACHINE, username, AbemaTVBaseIE._USERTOKEN)
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
# starting download using infojson from this extractor is undefined behavior,
|
|
|
|
# starting download using infojson from this extractor is undefined behavior,
|
|
|
|