Upgraded youtube_download plugin
This commit is contained in:
@@ -3,6 +3,7 @@ import re
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
clean_html,
|
||||
determine_ext,
|
||||
merge_dicts,
|
||||
parse_duration,
|
||||
@@ -12,6 +13,7 @@ from ..utils import (
|
||||
urlencode_postdata,
|
||||
urljoin,
|
||||
)
|
||||
from ..utils.traversal import find_element, traverse_obj, trim_str
|
||||
|
||||
|
||||
class SpankBangIE(InfoExtractor):
|
||||
@@ -122,7 +124,7 @@ class SpankBangIE(InfoExtractor):
|
||||
}), headers={
|
||||
'Referer': url,
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
})
|
||||
}, impersonate=True)
|
||||
|
||||
for format_id, format_url in stream.items():
|
||||
if format_url and isinstance(format_url, list):
|
||||
@@ -178,9 +180,9 @@ class SpankBangPlaylistIE(InfoExtractor):
|
||||
def _real_extract(self, url):
|
||||
mobj = self._match_valid_url(url)
|
||||
playlist_id = mobj.group('id')
|
||||
|
||||
webpage = self._download_webpage(
|
||||
url, playlist_id, headers={'Cookie': 'country=US; mobile=on'})
|
||||
country = self.get_param('geo_bypass_country') or 'US'
|
||||
self._set_cookie('.spankbang.com', 'country', country.upper())
|
||||
webpage = self._download_webpage(url, playlist_id, impersonate=True)
|
||||
|
||||
entries = [self.url_result(
|
||||
urljoin(url, mobj.group('path')),
|
||||
@@ -189,8 +191,8 @@ class SpankBangPlaylistIE(InfoExtractor):
|
||||
r'<a[^>]+\bhref=(["\'])(?P<path>/?[\da-z]+-(?P<id>[\da-z]+)/playlist/[^"\'](?:(?!\1).)*)\1',
|
||||
webpage)]
|
||||
|
||||
title = self._html_search_regex(
|
||||
r'<em>([^<]+)</em>\s+playlist\s*<', webpage, 'playlist title',
|
||||
fatal=False)
|
||||
title = traverse_obj(webpage, (
|
||||
{find_element(tag='h1', attr='data-testid', value='playlist-title')},
|
||||
{clean_html}, {trim_str(end=' Playlist')}))
|
||||
|
||||
return self.playlist_result(entries, playlist_id, title)
|
||||
|
||||
Reference in New Issue
Block a user