1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-18 19:28:31 +00:00

commit suggestion

This commit is contained in:
ocococ 2025-07-05 09:09:07 +02:00
parent bca329b2ec
commit 02fb2bafbc

View File

@ -1,5 +1,3 @@
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
@ -13,7 +11,7 @@
class WatIE(InfoExtractor): class WatIE(InfoExtractor):
_UUID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}' _UUID_RE = r'[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12}'
_VALID_URL = rf'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P<id>({_UUID_RE}|[0-9a-z]+))' _VALID_URL = rf'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P<id>{_UUID_RE}|[0-9]{{7,}}|(?:[a-z0-9]+_){{2}}|(?P<b36>[0-9a-z]+))(?:$|\.html|[#?/])'
IE_NAME = 'wat.tv' IE_NAME = 'wat.tv'
_TESTS = [ _TESTS = [
{ {
@ -78,7 +76,10 @@ class WatIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
video_id = video_id if re.fullmatch(fr'({self._UUID_RE}|\d{{7,}})', video_id) else str(int(video_id, 36)) video_id, b36_id = self._match_valid_url(url).group('id', 'b36')
if b36_id:
video_id = str(int(video_id, 36))
# 'contentv4' is used in the website, but it also returns the related # 'contentv4' is used in the website, but it also returns the related
# videos, we don't need them # videos, we don't need them