Plugin cleanup and tweaks

This commit is contained in:
2023-02-20 19:18:45 -06:00
parent 372e4ff3dc
commit 3ad9e1c7bb
1138 changed files with 48878 additions and 40445 deletions

View File

@@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import unicode_literals
import re
import time
@@ -65,11 +62,9 @@ class IPrimaIE(InfoExtractor):
'only_matching': True,
}]
def _login(self):
username, password = self._get_login_info()
if username is None or password is None:
self.raise_login_required('Login is required to access any iPrima content', method='password')
def _perform_login(self, username, password):
if self.access_token:
return
login_page = self._download_webpage(
self._LOGIN_URL, None, note='Downloading login page',
@@ -105,16 +100,16 @@ class IPrimaIE(InfoExtractor):
if self.access_token is None:
raise ExtractorError('Getting token failed', expected=True)
def _real_initialize(self):
if not self.access_token:
self.raise_login_required('Login is required to access any iPrima content', method='password')
def _raise_access_error(self, error_code):
if error_code == 'PLAY_GEOIP_DENIED':
self.raise_geo_restricted(countries=['CZ'], metadata_available=True)
elif error_code is not None:
self.raise_no_formats('Access to stream infos forbidden', expected=True)
def _real_initialize(self):
if not self.access_token:
self._login()
def _real_extract(self, url):
video_id = self._match_id(url)
@@ -153,9 +148,8 @@ class IPrimaIE(InfoExtractor):
elif manifest_type == 'DASH' or ext == 'mpd':
formats += self._extract_mpd_formats(
manifest_url, video_id, mpd_id='dash', fatal=False)
self._sort_formats(formats)
final_result = self._search_json_ld(webpage, video_id) or {}
final_result = self._search_json_ld(webpage, video_id, default={})
final_result.update({
'id': video_id,
'title': title,
@@ -253,8 +247,6 @@ class IPrimaCNNIE(InfoExtractor):
if not formats and '>GEO_IP_NOT_ALLOWED<' in playerpage:
self.raise_geo_restricted(countries=['CZ'], metadata_available=True)
self._sort_formats(formats)
return {
'id': video_id,
'title': title,