[ie/twitcasting] Support `--wait-for-video` (#7975)

Authored by: at-wat
This commit is contained in:
Atsushi Watanabe 2023-09-22 08:04:05 +09:00 committed by GitHub
parent 661c9a1d02
commit c1d71d0d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -5,8 +5,9 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..dependencies import websockets from ..dependencies import websockets
from ..utils import ( from ..utils import (
clean_html,
ExtractorError, ExtractorError,
UserNotLive,
clean_html,
float_or_none, float_or_none,
get_element_by_class, get_element_by_class,
get_element_by_id, get_element_by_id,
@ -235,6 +236,9 @@ class TwitCastingLiveIE(InfoExtractor):
_TESTS = [{ _TESTS = [{
'url': 'https://twitcasting.tv/ivetesangalo', 'url': 'https://twitcasting.tv/ivetesangalo',
'only_matching': True, 'only_matching': True,
}, {
'url': 'https://twitcasting.tv/c:unusedlive',
'expected_exception': 'UserNotLive',
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -260,7 +264,7 @@ class TwitCastingLiveIE(InfoExtractor):
r'(?s)<a\s+class="tw-movie-thumbnail"\s*href="/[^/]+/movie/(?P<video_id>\d+)"\s*>.+?</a>', r'(?s)<a\s+class="tw-movie-thumbnail"\s*href="/[^/]+/movie/(?P<video_id>\d+)"\s*>.+?</a>',
webpage, 'current live ID 2', default=None, group='video_id') webpage, 'current live ID 2', default=None, group='video_id')
if not current_live: if not current_live:
raise ExtractorError('The user is not currently live') raise UserNotLive(video_id=uploader_id)
return self.url_result('https://twitcasting.tv/%s/movie/%s' % (uploader_id, current_live)) return self.url_result('https://twitcasting.tv/%s/movie/%s' % (uploader_id, current_live))