2 from __future__ import unicode_literals
7 from .common import InfoExtractor
8 from .facebook import FacebookIE
11 class BuzzFeedIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?buzzfeed\.com/[^?#]*?/(?P<id>[^?#]+)'
14 'url': 'http://www.buzzfeed.com/abagg/this-angry-ram-destroys-a-punching-bag-like-a-boss?utm_term=4ldqpia',
16 'id': 'this-angry-ram-destroys-a-punching-bag-like-a-boss',
17 'title': 'This Angry Ram Destroys A Punching Bag Like A Boss',
18 'description': 'Rambro!',
24 'title': 'Angry Ram destroys a punching bag..',
25 'description': 'md5:c59533190ef23fd4458a5e8c8c872345',
26 'upload_date': '20141024',
27 'uploader_id': 'Buddhanz1',
28 'uploader': 'Angry Ram',
32 'url': 'http://www.buzzfeed.com/sheridanwatson/look-at-this-cute-dog-omg?utm_term=4ldqpia',
34 'skip_download': True, # Got enough YouTube download tests
37 'id': 'look-at-this-cute-dog-omg',
38 'description': 're:Munchkin the Teddy Bear is back ?!',
39 'title': 'You Need To Stop What You\'re Doing And Watching This Dog Walk On A Treadmill',
45 'title': 're:Munchkin the Teddy Bear gets her exercise',
46 'description': 'md5:28faab95cda6e361bcff06ec12fc21d8',
47 'upload_date': '20141124',
48 'uploader_id': 'CindysMunchkin',
49 'uploader': 're:^Munchkin the',
53 'url': 'http://www.buzzfeed.com/craigsilverman/the-most-adorable-crash-landing-ever#.eq7pX0BAmK',
55 'id': 'the-most-adorable-crash-landing-ever',
56 'title': 'Watch This Baby Goose Make The Most Adorable Crash Landing',
57 'description': 'This gosling knows how to stick a landing.',
60 'md5': '763ca415512f91ca62e4621086900a23',
62 'id': '971793786185728',
64 'title': 'We set up crash pads so that the goslings on our roof would have a safe landi...',
65 'uploader': 'Calgary Outdoor Centre-University of Calgary',
68 'add_ie': ['Facebook'],
71 def _real_extract(self, url):
72 playlist_id = self._match_id(url)
73 webpage = self._download_webpage(url, playlist_id)
75 all_buckets = re.findall(
76 r'(?s)<div class="video-embed[^"]*"..*?rel:bf_bucket_data=\'([^\']+)\'',
80 for bd_json in all_buckets:
81 bd = json.loads(bd_json)
82 video = bd.get('video') or bd.get('progload_video')
85 entries.append(self.url_result(video['url']))
87 facebook_url = FacebookIE._extract_url(webpage)
89 entries.append(self.url_result(facebook_url))
94 'title': self._og_search_title(webpage),
95 'description': self._og_search_description(webpage),