1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..compat import compat_urllib_parse_unquote
10 class PhotobucketIE(InfoExtractor):
11 _VALID_URL = r'http://(?:[a-z0-9]+\.)?photobucket\.com/.*(([\?\&]current=)|_)(?P<id>.*)\.(?P<ext>(flv)|(mp4))'
13 'url': 'http://media.photobucket.com/user/rachaneronas/media/TiredofLinkBuildingTryBacklinkMyDomaincom_zpsc0c3b9fa.mp4.html?filters[term]=search&filters[primary]=videos&filters[secondary]=images&sort=1&o=0',
14 'md5': '7dabfb92b0a31f6c16cebc0f8e60ff99',
18 'timestamp': 1367669341,
19 'upload_date': '20130504',
20 'uploader': 'rachaneronas',
21 'title': 'Tired of Link Building? Try BacklinkMyDomain.com!',
25 def _real_extract(self, url):
26 mobj = re.match(self._VALID_URL, url)
27 video_id = mobj.group('id')
28 video_extension = mobj.group('ext')
30 webpage = self._download_webpage(url, video_id)
32 # Extract URL, uploader, and title from webpage
33 self.report_extraction(video_id)
34 info_json = self._search_regex(r'Pb\.Data\.Shared\.put\(Pb\.Data\.Shared\.MEDIA, (.*?)\);',
36 info = json.loads(info_json)
37 url = compat_urllib_parse_unquote(self._html_search_regex(r'file=(.+\.mp4)', info['linkcodes']['html'], 'url'))
41 'uploader': info['username'],
42 'timestamp': info['creationDate'],
43 'title': info['title'],
44 'ext': video_extension,
45 'thumbnail': info['thumbUrl'],