1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import compat_urllib_parse
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 'file': 'zpsc0c3b9fa.mp4',
15 'md5': '7dabfb92b0a31f6c16cebc0f8e60ff99',
17 'timestamp': 1367669341,
18 'upload_date': '20130504',
19 'uploader': 'rachaneronas',
20 'title': 'Tired of Link Building? Try BacklinkMyDomain.com!',
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
27 video_extension = mobj.group('ext')
29 webpage = self._download_webpage(url, video_id)
31 # Extract URL, uploader, and title from webpage
32 self.report_extraction(video_id)
33 info_json = self._search_regex(r'Pb\.Data\.Shared\.put\(Pb\.Data\.Shared\.MEDIA, (.*?)\);',
35 info = json.loads(info_json)
36 url = compat_urllib_parse.unquote(self._html_search_regex(r'file=(.+\.mp4)', info['linkcodes']['html'], 'url'))
40 'uploader': info['username'],
41 'timestamp': info['creationDate'],
42 'title': info['title'],
43 'ext': video_extension,
44 'thumbnail': info['thumbUrl'],