mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 14:37:21 +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={}):
|
||||
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)
|
||||
|
||||
if PIAULIZAPortalAPIIE.BASE_URL in player_data_url:
|
||||
if player_data_url.startswith(PIAULIZAPortalAPIIE.BASE_URL):
|
||||
return self.url_result(
|
||||
smuggle_url(
|
||||
player_data_url,
|
||||
|
@ -57,8 +57,7 @@ def _real_extract(self, url):
|
|||
|
||||
prod_configure = self._download_webpage(
|
||||
self.PLAYER_ROOT_URL + self._search_regex(r'<script [^>]*\bsrc="(/statics/js/s_prod[^"]+)"', webpage, 'prod configure page'),
|
||||
program_code,
|
||||
headers={'Referer': self.PLAYER_ROOT_URL},
|
||||
program_code, headers={'Referer': self.PLAYER_ROOT_URL},
|
||||
note='Fetching prod configure page', errnote='Unable to fetch prod configure page',
|
||||
)
|
||||
|
||||
|
@ -69,11 +68,7 @@ def _real_extract(self, url):
|
|||
})
|
||||
player_tag_list = self._download_json(
|
||||
f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}',
|
||||
program_code,
|
||||
data=payload,
|
||||
headers={
|
||||
'Content-Type': content_type,
|
||||
},
|
||||
program_code, data=payload, headers={'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL},
|
||||
)
|
||||
|
||||
return self.handle_embed_player(
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
class PIAULIZAPortalAPIIE(InfoExtractor):
|
||||
IE_DESC = 'https://player-api.p.uliza.jp - PIA ULIZA m3u8'
|
||||
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>.*)'
|
||||
_TESTS = [
|
||||
|
@ -117,7 +117,7 @@ def _real_extract(self, url):
|
|||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
player_data_url = self._search_regex(
|
||||
PIAULIZAPortalAPIIE.TAG_REGEX_PATTERN,
|
||||
PIAULIZAPortalAPIIE.TAG_REGEX,
|
||||
webpage, 'player data url')
|
||||
return self.url_result(
|
||||
smuggle_url(
|
||||
|
|
Loading…
Reference in a new issue