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,10 +1,8 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
qualities,
try_call,
try_get,
ExtractorError,
)
@@ -26,10 +24,10 @@ class WhoWatchIE(InfoExtractor):
metadata = self._download_json('https://api.whowatch.tv/lives/%s' % video_id, video_id)
live_data = self._download_json('https://api.whowatch.tv/lives/%s/play' % video_id, video_id)
title = try_get(None, (
lambda x: live_data['share_info']['live_title'][1:-1],
lambda x: metadata['live']['title'],
), compat_str)
title = try_call(
lambda: live_data['share_info']['live_title'][1:-1],
lambda: metadata['live']['title'],
expected_type=str)
hls_url = live_data.get('hls_url')
if not hls_url:
@@ -72,7 +70,6 @@ class WhoWatchIE(InfoExtractor):
formats.extend(self._extract_m3u8_formats(
hls_url, video_id, ext='mp4', m3u8_id='hls'))
self._remove_duplicate_formats(formats)
self._sort_formats(formats)
uploader_url = try_get(metadata, lambda x: x['live']['user']['user_path'], compat_str)
if uploader_url: