aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/photobucket.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-06-09 17:54:27 -0500
committerJesús <heckyel@hyperbola.info>2021-06-09 17:54:27 -0500
commit27fe903c511691c078942bef5ee9a05a43b15c8f (patch)
tree50f30ab2ec749b965869518c0a28651f8677f0d3 /hypervideo_dl/extractor/photobucket.py
downloadhypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.tar.lz
hypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.tar.xz
hypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.zip
initial
Diffstat (limited to 'hypervideo_dl/extractor/photobucket.py')
-rw-r--r--hypervideo_dl/extractor/photobucket.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/hypervideo_dl/extractor/photobucket.py b/hypervideo_dl/extractor/photobucket.py
new file mode 100644
index 0000000..6c8bbe1
--- /dev/null
+++ b/hypervideo_dl/extractor/photobucket.py
@@ -0,0 +1,46 @@
+from __future__ import unicode_literals
+
+import json
+import re
+
+from .common import InfoExtractor
+from ..compat import compat_urllib_parse_unquote
+
+
+class PhotobucketIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:[a-z0-9]+\.)?photobucket\.com/.*(([\?\&]current=)|_)(?P<id>.*)\.(?P<ext>(flv)|(mp4))'
+ _TEST = {
+ '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',
+ 'md5': '7dabfb92b0a31f6c16cebc0f8e60ff99',
+ 'info_dict': {
+ 'id': 'zpsc0c3b9fa',
+ 'ext': 'mp4',
+ 'timestamp': 1367669341,
+ 'upload_date': '20130504',
+ 'uploader': 'rachaneronas',
+ 'title': 'Tired of Link Building? Try BacklinkMyDomain.com!',
+ }
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('id')
+ video_extension = mobj.group('ext')
+
+ webpage = self._download_webpage(url, video_id)
+
+ # Extract URL, uploader, and title from webpage
+ self.report_extraction(video_id)
+ info_json = self._search_regex(r'Pb\.Data\.Shared\.put\(Pb\.Data\.Shared\.MEDIA, (.*?)\);',
+ webpage, 'info json')
+ info = json.loads(info_json)
+ url = compat_urllib_parse_unquote(self._html_search_regex(r'file=(.+\.mp4)', info['linkcodes']['html'], 'url'))
+ return {
+ 'id': video_id,
+ 'url': url,
+ 'uploader': info['username'],
+ 'timestamp': info['creationDate'],
+ 'title': info['title'],
+ 'ext': video_extension,
+ 'thumbnail': info['thumbUrl'],
+ }