This forum is in archive mode. You will not be able to post new content.

Author Topic: Downloading someone elses images from Photobucket  (Read 10764 times)

0 Members and 1 Guest are viewing this topic.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Downloading someone elses images from Photobucket
« on: September 01, 2012, 07:01:29 PM »
EDIT: The method posted here still works and the script might work, but I had made a better version with completely automated script here: http://evilzone.org/evilzone-releases/a-better-photobucket-ripper/


Recently I posted on my blog how to download someone elses images from Photobucket with Python, so I decided I'll share it here since my blog isn't SEO'd very well and shit :P

I 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…
 There is this software called “Bulk image downloader” which is OK for a few images, but I had to get well over 1 thousand of them and that software was b0rking up.

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

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.

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.

What you first need to do is go to the album in your browser and click on “View as slideshow“, which will open an image slideshow.


Now when slideshow opens, go ahead and press “Ctlr+F3″ in Opera, or “Ctrl+U” in Firefox. You can also right-click anywhere on the page (except image itself) and select “View page source” or something similar.
 It will open up the HTML code, so scroll down and you will see “PB.Slideshow.data”.
 Copy everything from there to the end (down to the colon) and paste it into notepad and remove “PB.Slideshow.data = [" from the beginning and "];” at the end, so that only the data is left. Save it as “images.txt”.

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.

Code: (python) [Select]
'''
Simple script to download images from Photobucket album

http://9v.lt/blog/downloading-someone-elses-images-from-photobucket/

'''

import os
import re
import urllib
import time
import shutil

#====== global vars, change values here ======
mainFolder = 'PhotobucketGetter'
linkFile = 'images.txt'
noNameGirl = 'NoName'
#=============================================

print 'Creating a %s dir...' % mainFolder
try:
    os.mkdir(mainFolder)
except:
    shutil.rmtree(mainFolder)
    time.sleep(0.1)
    os.mkdir(mainFolder)
   
print 'Opening and reading "%s"...' % linkFile
linksFile = open(linkFile, 'r')
links = linksFile.read()
linksList = [i.strip() for i in re.split(',\s{2,}', links)]

print 'Compiling regex patterns and downloading the images...'
picUrl = re.compile('url: "(https?://[^.]+\.photobucket\.com/albums/[^/]+/[^/]+/[^/]+/[^/]+)",')
girlName = re.compile('title: "([\w\d]+)"')

counter = 1
for link in linksList:
    name = girlName.findall(link)
    if (len(name) == 0):
        name = noNameGirl
    else:
        name = name[0]
    if (os.path.exists(mainFolder+'/'+name) == False):
        os.mkdir(mainFolder+'/'+name)
    girlLink = picUrl.findall(link)
    girlLink = girlLink[0]
    fileName = os.path.basename(girlLink)
    print '%d. Retrieving "%s" into %s/ folder' % (counter, fileName, name)
    urllib.urlretrieve(girlLink, mainFolder+'/'+name+'/'+fileName)
    counter += 1
« Last Edit: November 27, 2012, 01:46:32 PM by Kulverstukas »

Offline pl0tuS

  • Knight
  • **
  • Posts: 320
  • Cookies: 22
    • View Profile
Re: Downloading someone elses images from Photobucket
« Reply #1 on: September 01, 2012, 07:32:47 PM »
God of Python!!
Really great work.. Applauds.


--Approved future mod :D --Factionwars

Z3R0

  • Guest
Re: Downloading someone elses images from Photobucket
« Reply #2 on: September 01, 2012, 07:48:39 PM »
Nice project dude. Pretty easy to understand for the most part, the only things I want to ask are where did you get your regex patterns? and what is the significance of girlName?

Line 35: Is girlName the title of the photos you are retrieving?
Code: (python) [Select]
girlName = re.compile('title: "([\w\d]+)"')
« Last Edit: September 01, 2012, 07:50:54 PM by m0rph »

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Downloading someone elses images from Photobucket
« Reply #3 on: September 01, 2012, 08:21:56 PM »
I developed the regex patters, with some help from Gizmore.
Variable names were meant to denote for what kinda pictures I am making this, but then I thought to share and didn't bother changing the variable names, so meh... kinda makes the code more fun xD

Offline chucky

  • NULL
  • Posts: 1
  • Cookies: 0
    • View Profile
Re: Downloading someone elses images from Photobucket
« Reply #4 on: November 26, 2012, 11:14:03 PM »
is it still working?

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Downloading someone elses images from Photobucket
« Reply #5 on: November 27, 2012, 08:24:57 AM »
is it still working?
Of course it's working. Try it and see next time?

Offline Axon

  • VIP
  • King
  • *
  • Posts: 2047
  • Cookies: 319
    • View Profile
Re: Downloading someone elses images from Photobucket
« Reply #6 on: November 27, 2012, 01:12:06 PM »
All hail the great python ;)

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Downloading someone elses images from Photobucket
« Reply #7 on: November 27, 2012, 01:45:34 PM »
Well it seems I forgot that I didn't update this thread. The code provided here is obsolete, I had created a new thread with the complete tool: http://evilzone.org/evilzone-releases/a-better-photobucket-ripper/

 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.