projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[beeg] Fix extraction (Closes #8225)
[youtube-dl]
/
youtube_dl
/
extractor
/
youtube.py
diff --git
a/youtube_dl/extractor/youtube.py
b/youtube_dl/extractor/youtube.py
index d63aa5f4e6e2eb78c100723f00d21f5648f1ca1e..e4f227f199d10ae3923acbc97d09263a9531470a 100644
(file)
--- a/
youtube_dl/extractor/youtube.py
+++ b/
youtube_dl/extractor/youtube.py
@@
-26,7
+26,7
@@
from ..compat import (
from ..utils import (
clean_html,
encode_dict,
from ..utils import (
clean_html,
encode_dict,
- error_to_str,
+ error_to_
compat_
str,
ExtractorError,
float_or_none,
get_element_by_attribute,
ExtractorError,
float_or_none,
get_element_by_attribute,
@@
-904,7
+904,7
@@
class YoutubeIE(YoutubeBaseInfoExtractor):
'https://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id,
video_id, note=False)
except ExtractorError as err:
'https://video.google.com/timedtext?hl=en&type=list&v=%s' % video_id,
video_id, note=False)
except ExtractorError as err:
- self._downloader.report_warning('unable to download video subtitles: %s' % error_to_str(err))
+ self._downloader.report_warning('unable to download video subtitles: %s' % error_to_
compat_
str(err))
return {}
sub_lang_list = {}
return {}
sub_lang_list = {}
@@
-1235,10
+1235,10
@@
class YoutubeIE(YoutubeBaseInfoExtractor):
video_description = re.sub(r'''(?x)
<a\s+
(?:[a-zA-Z-]+="[^"]+"\s+)*?
video_description = re.sub(r'''(?x)
<a\s+
(?:[a-zA-Z-]+="[^"]+"\s+)*?
-
title
="([^"]+)"\s+
+
(?:title|href)
="([^"]+)"\s+
(?:[a-zA-Z-]+="[^"]+"\s+)*?
(?:[a-zA-Z-]+="[^"]+"\s+)*?
- class="
yt-uix-redirect-link"\s*
>
- [^<]+
+ class="
(?:yt-uix-redirect-link|yt-uix-sessionlink[^"]*)".*?
>
+ [^<]+
\.{3}\s*
</a>
''', r'\1', video_description)
video_description = clean_html(video_description)
</a>
''', r'\1', video_description)
video_description = clean_html(video_description)
@@
-1487,7
+1487,7
@@
class YoutubeIE(YoutubeBaseInfoExtractor):
if codecs:
codecs = codecs.split(',')
if len(codecs) == 2:
if codecs:
codecs = codecs.split(',')
if len(codecs) == 2:
- acodec, vcodec = codecs[
0], codecs[1
]
+ acodec, vcodec = codecs[
1], codecs[0
]
else:
acodec, vcodec = (codecs[0], 'none') if kind == 'audio' else ('none', codecs[0])
dct.update({
else:
acodec, vcodec = (codecs[0], 'none') if kind == 'audio' else ('none', codecs[0])
dct.update({
@@
-1775,6
+1775,10
@@
class YoutubeChannelIE(YoutubePlaylistBaseInfoExtractor):
},
}]
},
}]
+ @classmethod
+ def suitable(cls, url):
+ return False if YoutubePlaylistsIE.suitable(url) else super(YoutubeChannelIE, cls).suitable(url)
+
def _real_extract(self, url):
channel_id = self._match_id(url)
def _real_extract(self, url):
channel_id = self._match_id(url)
@@
-1848,10
+1852,10
@@
class YoutubeUserIE(YoutubeChannelIE):
return super(YoutubeUserIE, cls).suitable(url)
return super(YoutubeUserIE, cls).suitable(url)
-class Youtube
User
PlaylistsIE(YoutubePlaylistsBaseInfoExtractor):
- IE_DESC = 'YouTube.com user playlists'
- _VALID_URL = r'https?://(?:\w+\.)?youtube\.com/
user
/(?P<id>[^/]+)/playlists'
- IE_NAME = 'youtube:
user:
playlists'
+class YoutubePlaylistsIE(YoutubePlaylistsBaseInfoExtractor):
+ IE_DESC = 'YouTube.com user
/channel
playlists'
+ _VALID_URL = r'https?://(?:\w+\.)?youtube\.com/
(?:user|channel)
/(?P<id>[^/]+)/playlists'
+ IE_NAME = 'youtube:playlists'
_TESTS = [{
'url': 'http://www.youtube.com/user/ThirstForScience/playlists',
_TESTS = [{
'url': 'http://www.youtube.com/user/ThirstForScience/playlists',
@@
-1868,6
+1872,13
@@
class YoutubeUserPlaylistsIE(YoutubePlaylistsBaseInfoExtractor):
'id': 'igorkle1',
'title': 'Игорь Клейнер',
},
'id': 'igorkle1',
'title': 'Игорь Клейнер',
},
+ }, {
+ 'url': 'https://www.youtube.com/channel/UCiU1dHvZObB2iP6xkJ__Icw/playlists',
+ 'playlist_mincount': 17,
+ 'info_dict': {
+ 'id': 'UCiU1dHvZObB2iP6xkJ__Icw',
+ 'title': 'Chem Player',
+ },
}]
}]