{"id":1421,"date":"2012-09-01T19:40:47","date_gmt":"2012-09-01T16:40:47","guid":{"rendered":"http:\/\/9v.lt\/blog\/?p=1421"},"modified":"2022-01-19T08:34:41","modified_gmt":"2022-01-19T06:34:41","slug":"downloading-someone-elses-images-from-photobucket","status":"publish","type":"post","link":"http:\/\/9v.lt\/blog\/downloading-someone-elses-images-from-photobucket\/","title":{"rendered":"Downloading someone elses images from Photobucket"},"content":{"rendered":"<p><strong><em>UPDATE<\/em>: there has been an update for the tool and it is now completely automated, Refer to the post here:<\/strong> <a href=\"http:\/\/9v.lt\/blog\/update-photobucket-ripper\/\">http:\/\/9v.lt\/blog\/update-photobucket-ripper\/<\/a><\/p>\n<p>Greetings.<br \/>\nAnother blog post after such a long time. This time about how to download images from photobucket, not owned by you. Because if you own the images, you can download all of them in a package from the control panel and whatnot.<br \/>\nBut what if you don&#8217;t own them? Well I guess you can open and download them one by one, but what if you have 1000+?<br \/>\n<!--more--><br \/>\nI was very surprised that I could not find any kind of image downloading software that would reliably do this. No Firefox add-ons or Opera Extensions&#8230;<br \/>\nThere is this software called &#8220;<a href=\"http:\/\/bulkimagedownloader.com\/bid\/download\/download-bulk-image-downloader\/\" target=\"_blank\" rel=\"noopener\">Bulk image downloader<\/a>&#8221; which is OK for a few images, but I had to get well over 1 thousand of them and that software was b0rking up.<\/p>\n<p>After some experimenting I found a way to get all the images I wanted, and once again I was saved by the code (this time Python) :D<\/p>\n<p>First things first, this method is not completely automated, so a computer illiterate blonde will have a hard time, but I will try to keep it very simple.<\/p>\n<p>So my method in theory works by copying the list of images in the code provided by the slidshow that photobucket provides. This is much simpler because there are much less text to process, compared to copying raw HTML code and parsing that way.<\/p>\n<p>What you first need to do is go to the album in your browser and click on &#8220;<em>View as slideshow<\/em>&#8220;, which will open an image slideshow.<\/p>\n<p>Now when slideshow opens, go ahead and press &#8220;Ctlr+F3&#8221; in Opera, or &#8220;Ctrl+U&#8221; in Firefox. You can also right-click anywhere on the page (except image itself) and select &#8220;View page source&#8221; or something similar.<br \/>\nIt will open up the HTML code, so scroll down and you will see &#8220;PB.Slideshow.data&#8221;.<br \/>\nCopy everything from there to the end (down to the colon) and paste it into notepad and remove &#8220;<em>PB.Slideshow.data = [<\/em>&#8221; from the beginning and &#8220;<em>];<\/em>&#8221; at the end, so that only the data is left. Save it as &#8220;images.txt&#8221;.<\/p>\n<p>Ok, cool. Now to get the images, all you have to do is copy the code I produced just for this, save it where you saved the images.txt and run it.<\/p>\n<pre lang=\"python\">\r\n'''\r\nSimple script to download images from Photobucket album\r\n<blockquote class=\"wp-embedded-content\" data-secret=\"XXWCrpnphm\"><a href=\"https:\/\/9v.lt\/blog\/downloading-someone-elses-images-from-photobucket\/\">Downloading someone elses images from Photobucket<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Downloading someone elses images from Photobucket&#8221; &#8212; Kulverstukas&#039;s blog\" src=\"https:\/\/9v.lt\/blog\/downloading-someone-elses-images-from-photobucket\/embed\/#?secret=9WcT6gt3m9#?secret=XXWCrpnphm\" data-secret=\"XXWCrpnphm\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\r\n'''\r\n\r\nimport os\r\nimport re\r\nimport urllib\r\nimport time\r\nimport shutil\r\n\r\n#====== global vars, change values here ======\r\nmainFolder = 'PhotobucketGetter'\r\nlinkFile = 'images.txt'\r\nnoNameGirl = 'NoName'\r\n#=============================================\r\n\r\nprint 'Creating a %s dir...' % mainFolder\r\ntry:\r\n    os.mkdir(mainFolder)\r\nexcept:\r\n    shutil.rmtree(mainFolder)\r\n    time.sleep(0.1)\r\n    os.mkdir(mainFolder)\r\n    \r\nprint 'Opening and reading \"%s\"...' % linkFile\r\nlinksFile = open(linkFile, 'r')\r\nlinks = linksFile.read()\r\nlinksList = [i.strip() for i in re.split(',\\s{2,}', links)]\r\n\r\nprint 'Compiling regex patterns and downloading the images...'\r\npicUrl = re.compile('url: \"(https?:\/\/[^.]+\\.photobucket\\.com\/albums\/[^\/]+\/[^\/]+\/[^\/]+\/[^\/]+)\",')\r\ngirlName = re.compile('title: \"([\\w\\d]+)\"')\r\n\r\ncounter = 1\r\nfor link in linksList:\r\n    name = girlName.findall(link)\r\n    if (len(name) == 0):\r\n        name = noNameGirl\r\n    else:\r\n        name = name[0]\r\n    if (os.path.exists(mainFolder+'\/'+name) == False):\r\n        os.mkdir(mainFolder+'\/'+name)\r\n    girlLink = picUrl.findall(link)\r\n    girlLink = girlLink[0]\r\n    fileName = os.path.basename(girlLink)\r\n    print '%d. Retrieving \"%s\" into %s\/ folder' % (counter, fileName, name)\r\n    urllib.urlretrieve(girlLink, mainFolder+'\/'+name+'\/'+fileName)\r\n    counter += 1\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE: there has been an update for the tool and it is now completely automated,<\/p>\n","protected":false},"author":2,"featured_media":1656,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[831,108],"class_list":["post-1421","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-eng","category-my-tutos","tag-photobucket","tag-python"],"_links":{"self":[{"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts\/1421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/comments?post=1421"}],"version-history":[{"count":0,"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts\/1421\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/media\/1656"}],"wp:attachment":[{"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/media?parent=1421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/categories?post=1421"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/tags?post=1421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}