How to delete ALL your Facebook Wall Posts (as required by Facebook prior to deleting/deactivating your account)

The script below is a fix of the script provided in “Use perl to automatically delete your facebook wall posts!“, as the new Facebook Wall broke the script, and is also an alternative to the Greasemonkey script “Facebook: Clear ALL activity“.

For those wondering why one would possibly need this, according to the Facebook Terms of Use,

When you delete IP content, it is deleted in a manner similar to emptying the recycle bin on a computer. However, you understand that removed content may persist in backup copies for a reasonable period of time (but will not be available to others).

We don’t know who are this “others” and who are not – yet everything you entered on Facebook is still at their disposal, which also according to the Facebook Terms of Use,

You grant us a non-exclusive, transferable, sub-licensable, royalty-free, worldwide license to use any IP content that you post on or in connection with Facebook (“IP License”).

When using third party applications (including Facebook Connect powered websites), the Facebook Terms of Use state that,

When you use an application, your content and information is shared with the application.  We require applications to respect your privacy, and your agreement with that application will control how the application can use, store, and transfer that content and information.

Require does not necessarily means by enforce, as we have seen already on Zynga’s scandal,

SAN FRANCISCO, Oct. 19 /PRNewswire/ — A class action lawsuit filed yesterday challenges Zynga’s alleged practice of illegally sharing the Facebook user data of its customers with advertisers and data brokers.

http://private.co/a1092124-facebook-user-sues-farmville-maker-zynga-.cfm

And at another level of privacy violation, the Facebook Terms of Use state clearly that,

You will not provide any false personal information on Facebook, or create an account for anyone other than yourself without permission.

So, they demand to know who exactly are you, which is easy to figure out later anyway, as all your  friends, private messages, social messages, public messages, pictures, likes, are all stored forever inside the archives of a company you know not about, nor had read their Terms of Use either.

What motivated me further anyway to fix the script and get rid of my Facebook account tho was the today released feature “Instant Personalization“, as mentioned in

Facebook’s Instant Personalization Is the Real Privacy Hairball

The settings are “enable all by default, and very little people know that they have to go throw many screens in order to actually deactivate it – and, if one of your friends does not, it was all in vain, as all your friends and their friends data are readily available to this websites and whoever else Facebook authorized or will authorize  to use.

You can not delete all of your account and your account data in one go – Facebook does not allow anyone to do it.

You need to manually delete all of it, and for people using it for years, it is simply not possible to delete, one by one, all of your data out of their systems, and even doing so the Facebook Terms of Use state that they will keep a hold of all of your data anyway (including your pictures), and there is nothing you can do about, as you should have read the Facebook Terms of Use before uploading them anyway.

So, this is when this script comes handy – even with it,  it takes a while and effort to get rid of your Facebook account. After running, your Wall will be empty, and  you can finish deleting your picture albums, favorites, groups, activities by hand, so you can deactivate or try sending them an email begging for your account to be deleted. By the way, good luck with that.

You will need PERL installed, and the following PERL packages,

WWW::Mechanize;

HTTP::Cookies;

HTML::Parser;

HTML::TagParser;

If you are new to PERL, you can install them by using your local PERL package manager, or by issuing the following in the command prompt (Windows CMD, Linux shell etc),

perl -MCPAN -e shell

When prompted, type,

install WWW::Mechanize

And PERL will install all required dependencies for you.

To run the script, save the text below as fb.pl, add your username and password, and run it with a double click or in the Command Line as above,

perl fb.pl

Be aware that this method goes against the Facebook Terms of Use, so it will delete only a few items at a time – you might need to run it over and over until your Facebook Wall is empty, which is not so bad as you can clear your picture albums, favorites, groups, activities by hand – believe me, it is unreal how hard Facebook holds to your data, as their business and the unknown reasons behind it is what the business is all about.

Script as follows.

#!/usr/bin/perl

use WWW::Mechanize;

use HTTP::Cookies;

use HTML::Parser;

use HTML::TagParser;

my $username = “PUT YOUR USERNAME HERE, escape the @ with @, so me@me.com”;

my $password = “PUT YOUR PASSWORD HERE”;

my $mech = WWW::Mechanize->new();

$mech->agent_alias(‘Linux Mozilla’);

$mech->cookie_jar( HTTP::Cookies->new() );

$mech->post(“https://login.facebook.com/login.php?m&next=http://m.facebook.com/minifeed.php”,{ email => $username, pass => $password });

my $test = $mech->content();

$mech->content() =~ /url=(.*?)”/;my $newurl = $1;$mech->get($newurl);

my $html = $mech->content();
my $parser = HTML::Parser->new( api_version => 3,                         start_h => [&start, "tagname, attr"],                         marked_sections => 1,                       );

my @links;

sub start {my ( $tagname, $attr ) = @_;

if ($tagname eq “a”) {push @links, $attr->{href};

}}

$parser->parse($html);

$parser->eof;foreach $link (@links) {

if ( $link =~ /delete.php/ ) {

print $link;$mech->get( “http://m.facebook.com” . $link );

$html_p = HTML::TagParser->new( $mech->content() );

@elem = $html_p->getElementsByTagName(“form”);

$action = $elem[0]->getAttribute(“action”);

@elem = $html_p->getElementsByAttribute( “name”, “fb_dtsg” );

$fb_dtsg = $elem[0]->getAttribute(“value”);

@elem = $html_p->getElementsByAttribute( “name”, “post_form_id” );

$ministory_key = $elem[0]->getAttribute(“value”);

@elem = $html_p->getElementsByAttribute( “name”, “charset_test” );

$story_type = $elem[0]->getAttribute(“value”);

print “Deleting facebook wall post: $ministory_key.. “;

$mech->post(“http://m.facebook.com” . $action,{fb_dtsg => $fb_dtsg,post_form_id => $ministory_key,charset_test => $story_type});

print “throttling for 5 seconds”;

sleep(5);

}}

I also uploaded a zipped version of the same, which you can download at http://www.mediafire.com/file/b9886tupe5elptu/fb.zip.

Update from the 31st of March 2011: I have just learned a link to a Facebook Delete Account button, please refer to How to delete your Facebook account.

Update from the 30th of November 2011: This code was published on the 5th of January 2011, is now officially marked as old, it is here for historical/archive purposes and only, I will not keep chasing Facebook at every change they do, and as a matter of fact I will not go near Facebook anymore.

Just to warn you that the 30 day wait without touching your account before they close it, is still valid on Facebook, so if you plan in getting rid of it, the earlier the better.


About these ads

44 thoughts on “How to delete ALL your Facebook Wall Posts (as required by Facebook prior to deleting/deactivating your account)

  1. Pingback: Hapus Iklan pada Facebook «

  2. Pingback: Cara Hapus Iklan pada Facebook « Blog History Education

  3. Pingback: The practical implication of Facebook’s privacy and sharing of information with third-party companies « Rove Monteux

  4. Incredible post but i’m having a few issues with it, It seems that the perl file seems to bring an end to itself after deleting a few posts. It’ll just completely stop, not sleep then continue. I have to re-run perl fb.pl again for it to start up.

    Any suggestions of a fix?

    • Hi Stephen,

      That was made in purpouse, if the Facebook system notices that you are trying to mechanize a mass deletion of your own posts (?), they will block your IP address out of Facebook (?).

      However, you can loop the whole script by wrapping a “my $running = 1; while ($running) {” after the “use” statements, and add a “}” at the very end of the script – you might also want to throttle it down with a call to “sleep(int(rand(11)) + 10);” before the last “}”, for the script to wait at a random space of time inbetween 10 to 20 seconds at each run, so it will look a little less suspiciously mechanized.

      Beware that posts older than a certain amount of time, say, 1 year, even if your wall is already empty of entries up to that date, will be hidden, and the only way to see them is to press the “display older entries” link in your Facebook wall; so the script above will be limited to delete all until the rest of the data is hidden on Facebook – the Greasemonkey script mentioned in the post might work or might not with such hidden entries, also a macro recorder might help in the same way, both will take forever to do it and if they dont work as desired you will need to delete up to as many years of data you input onto Facebook by hand, before even considering begging them to completely delete your account.

      If you joined one of their partner sites like Yahoo, they have all of your data saved on them own servers as well, and even if you did not join but a contact of yours did, they have all of your data saved on them own servers as well, so deleting it out of Facebook will not delete all you made and put or not at their disposal.

      Either way, Facebook do not want you to take your own data away from them as their terms of use state very clearly, their entire business is based on people basically working for them for free, which in my opinion is actually a good thing, as after spending days or even weeks trying to get rid of their own innocently input private data, the chances of people falling again into such a dirty trick are probably minimal.

  5. Pingback: أضافات رائعة للفيس بوك « مدونة حلم الإبداع

  6. Hi.
    Thanks for everything on this site!

    Im a bit of a idiot when it comes to computers though.. I want to ask you soething before I even start;

    What I would like to do, is to be able to delete everything I wrote on other peoples walls during the years. Is that possibe? And would it also work for what I wrote in groups?

    Thanks a lot gain!

    Best regards,
    Michael

    • Hi Michael,

      You are more than welcome, and thanks a million for the comments.

      As far as I know it is not possible, no – Facebook pretty much assumes everything you wrote and uploaded was given to them, as it sits in their servers and use their systems, so the only choice they give at the moment is for you to manually delete it.

      As your posts will remain in the system even if the account is marked as inactive (inactive for them is the same as marking yourself as “away” in a messenger), the choices of you eventually going back to use it are much higher as if you mass deleted the lot in anger and closed the account, all in one go.

      As far as I am aware not even the macro recorders will not optimally jump pages as far as other peoples walls and groups, which would take a lot of time to get done, but if someone have tried and managed to successfully do it, please send a comment with a short tutorial on how you did it.

      The script above is an automation of a manual deletion, it uses the Facebook mobile site to do so as it have a plain interface, and even this one will only work until Facebook change its internals, which happens quite often – by when this script will have to be rewritten all over again.

      I think lots of people are starting to realize what is it really about, even if a bit too late, but word of advice is to only post what you absolutely want everybody to know, even if not explicitly marked as public, including family, friends, friends of friends, enemies, bosses, co-workers, marketing people, corporations, institutions, governments, fake personas, etc – Facebook is short of being a digital ID implemented by a single, private company.

  7. Pingback: Protecting your online privacy « Rove Monteux

  8. Pingback: How to delete your Facebook account « Rove Monteux

  9. i hope this is not a silly question but do you need to have your browser open while running this and if so which browser? does this still work with the new timeline changes? cheers :)

    • Hi,

      No need for the browser running at all no, it emulates a browser using the mobile site.

      I don’t know if Facebook changed its site again, so please do give feedback if it still works or not.

    • Hi, it is Perl so you will need to open a console (start->run->then type “cmd” and enter), go to the folder the files is in and run perl filename.pl. That will tell you whats going on, it is probably missing a perl module, please refer to the conversation above on how to install Perl modules.

  10. Great! Works like a champ…but want to let Linux users know (I assume its the same for Windows, but I don’t know how WOS works with repositories) you need to also have the Crypt::SSLeay dependency and libssl-dev installed. If you don’t you will get SSL errors. :) Thanks for the help!

  11. having the following run-time problems with the script after correcting for problem with module:

    Unrecognized character \x93; marked by <– HERE after sername = perl delfbwall.pl
    Unrecognized character \x93; marked by <– HERE after sername = perl delfbwall.pl
    Unrecognized character \x91; marked by <– HERE after ent_alias(perl delfbwall.pl
    Unrecognized character \x91; marked by <– HERE after ent_alias(perl delfbwall.pl
    Bareword found where operator expected at delfbwall.pl line 28, near “my $parser
    = HTML::Parser->new( api_version => 3, start_h => [&sta
    rt, "tagname"
    (Might be a runaway multi-line "" string starting on line 21)
    (Do you need to predeclare my?)
    String found where operator expected at delfbwall.pl line 34, near "if ($tagname
    eq ""
    (Might be a runaway multi-line "" string starting on line 28)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 44, near "print $link;
    $mech->get( ""
    (Might be a runaway multi-line "" string starting on line 34)
    (Missing semicolon on previous line?)
    syntax error at delfbwall.pl line 28, near "my $parser = HTML::Parser->new( api_
    version => 3, start_h => [&start, "tagname"
    Unrecognized character \x94; marked by <-- HERE after cebook.comperl delfbwall.pl
    Bareword found where operator expected at delfbwall.pl line 28, near "my $parser
    = HTML::Parser->new( api_version => 3, start_h => [&sta
    rt, "tagname"
    (Might be a runaway multi-line "" string starting on line 21)
    (Do you need to predeclare my?)
    String found where operator expected at delfbwall.pl line 34, near "if ($tagname
    eq ""
    (Might be a runaway multi-line "" string starting on line 28)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 44, near "print $link;
    $mech->get( ""
    (Might be a runaway multi-line "" string starting on line 34)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 48, near "@elem = $htm
    l_p->getElementsByTagName(""
    (Might be a runaway multi-line "" string starting on line 44)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 50, near "$action = $e
    lem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 48)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 52, near “@elem = $htm
    l_p->getElementsByAttribute( “”
    (Might be a runaway multi-line “” string starting on line 50)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 52, near “name”, “”
    Bareword found where operator expected at delfbwall.pl line 52, near “”, “fb_dts
    g”
    (Missing operator before fb_dtsg?)
    String found where operator expected at delfbwall.pl line 54, near “$fb_dtsg = $
    elem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 52)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 56, near “@elem = $htm
    l_p->getElementsByAttribute( “”
    (Might be a runaway multi-line “” string starting on line 54)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 56, near “name”, “”
    Bareword found where operator expected at delfbwall.pl line 56, near “”, “post_f
    orm_id”
    (Missing operator before post_form_id?)
    String found where operator expected at delfbwall.pl line 58, near “$ministory_k
    ey = $elem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 56)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 60, near “@elem = $htm
    l_p->getElementsByAttribute( “”
    (Might be a runaway multi-line “” string starting on line 58)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 60, near “name”, “”
    Bareword found where operator expected at delfbwall.pl line 60, near “”, “charse
    t_test”
    (Missing operator before charset_test?)
    String found where operator expected at delfbwall.pl line 62, near “$story_type
    = $elem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 60)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 64, near “print “”
    (Might be a runaway multi-line “” string starting on line 62)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at delfbwall.pl line 64, near “print “Del
    eting”
    (Do you need to predeclare print?)
    String found where operator expected at delfbwall.pl line 68, near “print “”
    (Might be a runaway multi-line “” string starting on line 66)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at delfbwall.pl line 68, near “5 seconds”

    (Missing operator before seconds?)
    String found where operator expected at delfbwall.pl line 68, at end of line
    (Missing semicolon on previous line?)
    syntax error at delfbwall.pl line 28, near “my $parser = HTML::Parser->new( api_
    version => 3, start_h => [&start, "tagname"
    Can't find string terminator '"' anywhere before EOF at delfbwall.pl line 68.

    C:\Perl64>
    C:\Perl64>perl delfbwall.pl
    Bareword found where operator expected at delfbwall.pl line 28, near "my $parser
    = HTML::Parser->new( api_version => 3, start_h => [&sta
    rt, "tagname"
    (Might be a runaway multi-line "" string starting on line 21)
    (Do you need to predeclare my?)
    String found where operator expected at delfbwall.pl line 34, near "if ($tagname
    eq ""
    (Might be a runaway multi-line "" string starting on line 28)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 44, near "print $link;
    $mech->get( ""
    (Might be a runaway multi-line "" string starting on line 34)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 48, near "@elem = $htm
    l_p->getElementsByTagName(""
    (Might be a runaway multi-line "" string starting on line 44)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 50, near "$action = $e
    lem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 48)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 52, near “@elem = $htm
    l_p->getElementsByAttribute( “”
    (Might be a runaway multi-line “” string starting on line 50)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 52, near “name”, “”
    Bareword found where operator expected at delfbwall.pl line 52, near “”, “fb_dts
    g”
    (Missing operator before fb_dtsg?)
    String found where operator expected at delfbwall.pl line 54, near “$fb_dtsg = $
    elem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 52)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 56, near “@elem = $htm
    l_p->getElementsByAttribute( “”
    (Might be a runaway multi-line “” string starting on line 54)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 56, near “name”, “”
    Bareword found where operator expected at delfbwall.pl line 56, near “”, “post_f
    orm_id”
    (Missing operator before post_form_id?)
    String found where operator expected at delfbwall.pl line 58, near “$ministory_k
    ey = $elem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 56)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 60, near “@elem = $htm
    l_p->getElementsByAttribute( “”
    (Might be a runaway multi-line “” string starting on line 58)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 60, near “name”, “”
    Bareword found where operator expected at delfbwall.pl line 60, near “”, “charse
    t_test”
    (Missing operator before charset_test?)
    String found where operator expected at delfbwall.pl line 62, near “$story_type
    = $elem[0]->getAttribute(“”
    (Might be a runaway multi-line “” string starting on line 60)
    (Missing semicolon on previous line?)
    String found where operator expected at delfbwall.pl line 64, near “print “”
    (Might be a runaway multi-line “” string starting on line 62)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at delfbwall.pl line 64, near “print “Del
    eting”
    (Do you need to predeclare print?)
    String found where operator expected at delfbwall.pl line 68, near “print “”
    (Might be a runaway multi-line “” string starting on line 66)
    (Missing semicolon on previous line?)
    Bareword found where operator expected at delfbwall.pl line 68, near “5 seconds”

    (Missing operator before seconds?)
    String found where operator expected at delfbwall.pl line 68, at end of line
    (Missing semicolon on previous line?)
    syntax error at delfbwall.pl line 28, near “my $parser = HTML::Parser->new( api_
    version => 3, start_h => [&start, “tagname”
    Can’t find string terminator ‘”‘ anywhere before EOF at delfbwall.pl line 68.

  12. Pingback: Social freedom: Diaspora « Rove Monteux

  13. Pingback: Social freedom: Diaspora | Rove Monteux

  14. Thanks for the reply. The downloaded version worked, but when I ran it nothing happened. It just printed my username and password and died. Any help would be appreciated. Thanks again.

  15. @pgravelle = same thing happens to me and it does not work on timeline.

    i found

    http://cleanmywall.netbew.com/

    which deleted all my old posts beautifully but when i enabled timeline everything came back.

    i would love a solution that
    1.worked
    2.works with timeline

    i am seriously considering opening a new facebook account and closing my existing account.

    • Facebook changes its site/API all the time, so indeed the solution above might not work anymore without having to be reprogrammed all over again.

      It is Facebook’s fault anyway, their Terms of Service have as many holes as a drainer, and the fact that you can not delete all your stuff all in one go is one of them – why would you close and open another account tho, rebuild all contacts etc, if you know that you will go through the exact very same at some point in the future ?

      There are a range of similar services out there, Social Networks, that are not so keen in your data anyway, to name a few Twitter, Diaspora, Qaiku etc.

    • haha, I wish you best of luck with that.

      I gave up going near Facebook, short of giving up on Twitter and I joined the community effort on Diaspora instead.

      Just to warn you that the 30 day wait without touching your account before they close it, is still valid on Facebook, so if you plan in getting rid of it, the earlier the better.

      The code above is now officially marked as old, it is here for historical/archive purposes and only, I will not keep chasing Facebook at every change they do, and as a matter of fact I will not go near Facebook anymore.

  16. @rmonteux twitter just gave the us government a bunch of user info. not sure i feel very safe with twitter anymore.

    i guess you have to assume that if you join a social network all your info can and probably will be compromised in some way.

    • Indeed you are right, just the level and type of compromise varies – I am not aware of Twitter selling your information for marketing for example, but I am annoyed as anyone does to find sponsored “celebrities” and sponsored messages thrown at me at random, and the constant fact of the same always trying to sneak in to be added as a contact by me – I can only imagine that as they need to get the investment funds back, it will only get worse as time passes by.

      Safety in the Internet as a whole is relative, for more encrypted and/or distributed something is, there will always be a way to trace it down and to get it open, be it by skill or by force, or by enforcement.

      I started adventuring myself on the Diaspora thing anyway, setup my own Pod and all and got to talk with people in different pods, the whole thing is very interesting, even tho its alpha, as data sits in tons of servers yet your own data sits in your very own, or the one of your choice, all is distributed rather a single central closed source data center owned and run by a single corporation with a dodgy Terms of Service on top of it.

      If you want to have a look at how it works, mine is at http://diaspora.happeningin.eu/ – I am keeping it synchronized with the main sources, so any commit the developers do is live in there as well – you can add people from other pods as well, and be added to other pods – my own username is rovemonteux@diaspora.happeningin.eu.

      There is also the fact that the pod have the source code for the lot, and can re-program/adjust/block whatever is it they want according to their own policies and skills.

  17. I’m the author of the original perl script you linked to above, thanks for the mention ..

    I wanted to point out another alternative called CleanMyWall, there used to be cleanmywall.net which went down, but another site has taken over ..

    http://cleanmywall.netbew.com/install.html

    This is a bookmarklet that is really clever, you just run the bookmarklet from your wall page, it lets you select some options and then it begins deleting away ..

  18. Hi. I see the original post is quite old. I am wondering if there is a currently working method for deleting all previous wall posts that works with Timeline. I have a day before Facebook enforces Timeline upon me. Right now I see it in the Timeline format when I log in but it still says that I have one more day before it goes ‘live”. Your help would be much appreciated. Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s