Facebook Spider

2009-09-03. I was looking at the code again after briefly discussing a similar project with Tommy, and realized that Facebook can still do pictures the way I had it set up before. The code needed some altering but is generally functional again. It could use some more cleaning. Revised Link at the bottom or Here.

2008-09-16.  Today I was looking at Facebook’s new layout. It will break this script and require a rewrite to become functional again. Facebook has transitioned to using a large amount of javascript for its operations so it will require a different method.  One possible relatively simple solution would be ChickenFoot, but it is not very widely used.

I started a little script awhile ago as a means of spidering photos for Facebook. I might refer to it as FS, Facebook Spider, or perhaps FSP, Facebook Spider for Photos. It is written in Python.

Since I originally assembled the script, Facebook has changed its layout a decent amount, but with some tweaking the script still works.

The program is far from perfect and serves as much as a proof of concept for my own self as anything else. It is single threaded and searches through photos in order, similar to how a human would look through them, which is important because Facebook at times has ended the connection, which I can only assume to be by trying to do too much in too little time. Additionally, the searching might be more efficient if it were done using regular expressions, but should be functional how it is. At least, until Facebook reworks its site again just to throw things slightly off.

It functions by logging in as an end user and therefore only has access to the same photos that that user would be able to access.Its use is relatively simple and interactive — just login as it prompts and enter the person you wish to search for, or 0 if you just wish to search for yourself and 1 to exit.

I do not plan on releasing binaries, just the source which will be released under GPL V2.0. I hope that someone else just finds this as an interesting project and maybe thinks of interesting add ons or neat tricks and let me know 🙂

Here is the source

5 thoughts on “Facebook Spider

  1. Apparently facebook has changed something about how the photo page is displayed, I edited the script so that it finds the picture correctly starting at line 126:

    picPage = picResponse.read()
    # print “picURL: ” + picUrl
    picPage = picPage[picPage.find(‘id=”myphotolink”><img src=”‘):]
    picPage = picPage[picPage.find(“http://photos”):]
    picPage = picPage[:picPage.find(‘”‘)]
    # print “picPage: ” + picPage

  2. Ah, it appears that if you have the developer package or perhaps other applications for facebook that the script might not work properly. (I don’t have any..)

    Good eye Tommy for figuring that out. I updated the linked source.

    1. Adam, glad you’re interested. This code is several years out of date (an eternity by Facebook’s standards). Though I know of no reason a similar approach couldn’t be taken today.

      You might be interested in Tommy’s similar project: https://code.google.com/p/photograbber/

      However, I have made the links work again, thanks for pointing out that it wasn’t before!

Leave a Reply

Your email address will not be published. Required fields are marked *