1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 19:52:11 +00:00

[buzzfeed] Add support for more video types (#4259)

This commit is contained in:
Philipp Hagemeister 2014-11-27 15:44:35 +01:00
parent ad0d800fc3
commit 4207558e8b

View file

@ -9,7 +9,7 @@ from .common import InfoExtractor
class BuzzFeedIE(InfoExtractor): class BuzzFeedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?buzzfeed\.com/[^?#]*?/(?P<id>[^?#]+)' _VALID_URL = r'https?://(?:www\.)?buzzfeed\.com/[^?#]*?/(?P<id>[^?#]+)'
_TEST = { _TESTS = [{
'url': 'http://www.buzzfeed.com/abagg/this-angry-ram-destroys-a-punching-bag-like-a-boss?utm_term=4ldqpia', 'url': 'http://www.buzzfeed.com/abagg/this-angry-ram-destroys-a-punching-bag-like-a-boss?utm_term=4ldqpia',
'info_dict': { 'info_dict': {
'id': 'this-angry-ram-destroys-a-punching-bag-like-a-boss', 'id': 'this-angry-ram-destroys-a-punching-bag-like-a-boss',
@ -27,21 +27,43 @@ class BuzzFeedIE(InfoExtractor):
'title': 'Angry Ram destroys a punching bag', 'title': 'Angry Ram destroys a punching bag',
} }
}] }]
} }, {
'url': 'http://www.buzzfeed.com/sheridanwatson/look-at-this-cute-dog-omg?utm_term=4ldqpia',
'params': {
'skip_download': True, # Got enough YouTube download tests
},
'info_dict': {
'description': 'Munchkin the Teddy Bear is back !',
'title': 'You Need To Stop What You\'re Doing And Watching This Dog Walk On A Treadmill',
},
'playlist': [{
'info_dict': {
'id': 'mVmBL8B-In0',
'ext': 'mp4',
'upload_date': '20141124',
'uploader_id': 'CindysMunchkin',
'description': '© 2014 Munchkin the Shih Tzu\nAll rights reserved\nFacebook: http://facebook.com/MunchkintheShihTzu',
'uploader': 'Munchkin the Shih Tzu',
'title': 'Munchkin the Teddy Bear gets her exercise',
},
}]
}]
def _real_extract(self, url): def _real_extract(self, url):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id) webpage = self._download_webpage(url, playlist_id)
all_buckets = re.findall( all_buckets = re.findall(
r'<div class="video-embed-videopost[^"]*".*?rel:bf_bucket_data=\'([^\']+)\'', r'(?s)<div class="video-embed[^"]*"..*?rel:bf_bucket_data=\'([^\']+)\'',
webpage) webpage)
entries = [] entries = []
for bd_json in all_buckets: for bd_json in all_buckets:
bd = json.loads(bd_json) bd = json.loads(bd_json)
if 'video' not in bd: video = bd.get('video') or bd.get('progload_video')
if not video:
continue continue
entries.append(self.url_result(bd['video']['url'])) entries.append(self.url_result(video['url']))
return { return {
'_type': 'playlist', '_type': 'playlist',