mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-05 07:53:18 +00:00
clean code
This commit is contained in:
parent
16d3268cf9
commit
3997c6d84b
|
@ -33,27 +33,24 @@ class FYPTTIE(InfoExtractor):
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _download_webpage_handle(self, *args, **kwargs):
|
||||||
|
headers = kwargs.get('headers', {}).copy()
|
||||||
|
headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36'
|
||||||
|
kwargs['headers'] = headers
|
||||||
|
return super(FYPTTIE, self)._download_webpage_handle(
|
||||||
|
*args, **kwargs)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
|
|
||||||
# format_url = self._html_search_regex(r'<span">(.+?)</span>', webpage, 'title')
|
|
||||||
format_url = self._html_search_regex(r'"embedURL":"([^"]+)"', webpage, 'video URL')
|
format_url = self._html_search_regex(r'"embedURL":"([^"]+)"', webpage, 'video URL')
|
||||||
|
|
||||||
# Remove invalid characters using regex
|
|
||||||
format_url = re.sub(r'\\', '', format_url)
|
format_url = re.sub(r'\\', '', format_url)
|
||||||
print("format_url")
|
|
||||||
print(format_url)
|
|
||||||
webpage_video = self._download_webpage(format_url, video_id)
|
webpage_video = self._download_webpage(format_url, video_id)
|
||||||
|
|
||||||
|
|
||||||
# format_url = self._html_search_regex(r'<source\s+src="(.+?)"\s+type', webpage, 'format_url')
|
|
||||||
match = re.search(r'<source\s+src="(.+?)"\s+type', webpage_video)
|
match = re.search(r'<source\s+src="(.+?)"\s+type', webpage_video)
|
||||||
|
|
||||||
format_url = match.group(1)
|
format_url = match.group(1)
|
||||||
print(match)
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
'format_id': 'default',
|
'format_id': 'default',
|
||||||
|
@ -61,7 +58,6 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
title = self._html_search_regex(r'<span class="fl-heading-text">(.+?)</span>', webpage, 'title')
|
title = self._html_search_regex(r'<span class="fl-heading-text">(.+?)</span>', webpage, 'title')
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
|
|
Loading…
Reference in a new issue