mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-27 13:15:04 +00:00
chore: rename regex and add referer
This commit is contained in:
parent
3fa3edc3c4
commit
1a16c62638
@ -36,10 +36,10 @@ class PiaLiveIE(InfoExtractor):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def handle_embed_player(self, player_tag, video_id, info_dict={}):
|
def handle_embed_player(self, player_tag, video_id, info_dict={}):
|
||||||
player_data_url = self._search_regex([PIAULIZAPortalAPIIE.TAG_REGEX_PATTERN],
|
player_data_url = self._search_regex([PIAULIZAPortalAPIIE.TAG_REGEX],
|
||||||
player_tag, 'player data url', fatal=False)
|
player_tag, 'player data url', fatal=False)
|
||||||
|
|
||||||
if PIAULIZAPortalAPIIE.BASE_URL in player_data_url:
|
if player_data_url.startswith(PIAULIZAPortalAPIIE.BASE_URL):
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
smuggle_url(
|
smuggle_url(
|
||||||
player_data_url,
|
player_data_url,
|
||||||
@ -57,8 +57,7 @@ class PiaLiveIE(InfoExtractor):
|
|||||||
|
|
||||||
prod_configure = self._download_webpage(
|
prod_configure = self._download_webpage(
|
||||||
self.PLAYER_ROOT_URL + self._search_regex(r'<script [^>]*\bsrc="(/statics/js/s_prod[^"]+)"', webpage, 'prod configure page'),
|
self.PLAYER_ROOT_URL + self._search_regex(r'<script [^>]*\bsrc="(/statics/js/s_prod[^"]+)"', webpage, 'prod configure page'),
|
||||||
program_code,
|
program_code, headers={'Referer': self.PLAYER_ROOT_URL},
|
||||||
headers={'Referer': self.PLAYER_ROOT_URL},
|
|
||||||
note='Fetching prod configure page', errnote='Unable to fetch prod configure page',
|
note='Fetching prod configure page', errnote='Unable to fetch prod configure page',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -69,11 +68,7 @@ class PiaLiveIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
player_tag_list = self._download_json(
|
player_tag_list = self._download_json(
|
||||||
f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}',
|
f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}',
|
||||||
program_code,
|
program_code, data=payload, headers={'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL},
|
||||||
data=payload,
|
|
||||||
headers={
|
|
||||||
'Content-Type': content_type,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.handle_embed_player(
|
return self.handle_embed_player(
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from ..utils import ExtractorError, int_or_none, parse_qs, smuggle_url, time_sec
|
|||||||
class PIAULIZAPortalAPIIE(InfoExtractor):
|
class PIAULIZAPortalAPIIE(InfoExtractor):
|
||||||
IE_DESC = 'https://player-api.p.uliza.jp - PIA ULIZA m3u8'
|
IE_DESC = 'https://player-api.p.uliza.jp - PIA ULIZA m3u8'
|
||||||
BASE_URL = 'https://player-api.p.uliza.jp'
|
BASE_URL = 'https://player-api.p.uliza.jp'
|
||||||
TAG_REGEX_PATTERN = r'<script [^>]*\bsrc="(https://player-api\.p\.uliza\.jp/v1/players/[^"]+)"'
|
TAG_REGEX = r'<script [^>]*\bsrc="(https://player-api\.p\.uliza\.jp/v1/players/[^"]+)"'
|
||||||
|
|
||||||
_VALID_URL = r'https://player-api\.p\.uliza\.jp/v1/players/(?P<id>.*)'
|
_VALID_URL = r'https://player-api\.p\.uliza\.jp/v1/players/(?P<id>.*)'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
@ -117,7 +117,7 @@ class PIAULIZAPortalIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
player_data_url = self._search_regex(
|
player_data_url = self._search_regex(
|
||||||
PIAULIZAPortalAPIIE.TAG_REGEX_PATTERN,
|
PIAULIZAPortalAPIIE.TAG_REGEX,
|
||||||
webpage, 'player data url')
|
webpage, 'player data url')
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
smuggle_url(
|
smuggle_url(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user