mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-01 02:37:29 +01:00
[xhamster:embed] Extract vars (Closes #8912)
This commit is contained in:
parent
1600ed1ff9
commit
065c4b27bf
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
dict_get,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
@ -170,6 +171,12 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
video_url = self._search_regex(
|
video_url = self._search_regex(
|
||||||
r'href="(https?://xhamster\.com/movies/%s/[^"]+\.html[^"]*)"' % video_id,
|
r'href="(https?://xhamster\.com/movies/%s/[^"]+\.html[^"]*)"' % video_id,
|
||||||
webpage, 'xhamster url')
|
webpage, 'xhamster url', default=None)
|
||||||
|
|
||||||
|
if not video_url:
|
||||||
|
vars = self._parse_json(
|
||||||
|
self._search_regex(r'vars\s*:\s*({.+?})\s*,\s*\n', webpage, 'vars'),
|
||||||
|
video_id)
|
||||||
|
video_url = dict_get(vars, ('downloadLink', 'homepageLink', 'commentsLink', 'shareUrl'))
|
||||||
|
|
||||||
return self.url_result(video_url, 'XHamster')
|
return self.url_result(video_url, 'XHamster')
|
||||||
|
Loading…
Reference in New Issue
Block a user