From 9c2a6fa44928200f281c94ce23537801a4c9e6d3 Mon Sep 17 00:00:00 2001 From: ChocoLZS Date: Wed, 21 Aug 2024 11:43:45 +0800 Subject: [PATCH] feat: add support for uliza in pia-live --- yt_dlp/extractor/_extractors.py | 3 +- yt_dlp/extractor/pialive.py | 55 ++++++++++++++ yt_dlp/extractor/piaulizaportal.py | 118 +++++++++++++++++++++-------- 3 files changed, 144 insertions(+), 32 deletions(-) create mode 100644 yt_dlp/extractor/pialive.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index 9b73fcd75e..d9d2609078 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -1510,8 +1510,9 @@ from .pgatour import PGATourIE from .philharmoniedeparis import PhilharmonieDeParisIE from .phoenix import PhoenixIE from .photobucket import PhotobucketIE +from .pialive import PiaLiveIE from .piapro import PiaproIE -from .piaulizaportal import PIAULIZAPortalIE +from .piaulizaportal import PIAULIZAPortalAPIIE, PIAULIZAPortalIE from .picarto import ( PicartoIE, PicartoVodIE, diff --git a/yt_dlp/extractor/pialive.py b/yt_dlp/extractor/pialive.py new file mode 100644 index 0000000000..d662f372da --- /dev/null +++ b/yt_dlp/extractor/pialive.py @@ -0,0 +1,55 @@ +from .common import InfoExtractor +from .piaulizaportal import PIAULIZAPortalAPIIE +from ..networking import Request +from ..utils import multipart_encode, smuggle_url + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_URL = r'https?://player\.pia-live\.jp/stream/(?P[\w-]+)' + + def _real_extract(self, url): + video_key = self._match_id(url) + webpage = self._download_webpage(url, video_key) + program_code = self._search_regex(r"const programCode = '(.*?)';", webpage, 'program code') + + prod_configure = self._download_webpage( + self.PLAYER_ROOT_URL + self._search_regex(r'