<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lonnie Knows Everything &#187; perl</title>
	<atom:link href="http://blog.oneduality.com/tag/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.oneduality.com</link>
	<description>So you don&#039;t have to!</description>
	<lastBuildDate>Wed, 30 Nov 2011 19:37:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Use perl to automatically delete your facebook wall posts!</title>
		<link>http://blog.oneduality.com/2010/05/06/use-perl-to-automatically-delete-your-facebook-wall-posts/</link>
		<comments>http://blog.oneduality.com/2010/05/06/use-perl-to-automatically-delete-your-facebook-wall-posts/#comments</comments>
		<pubDate>Thu, 06 May 2010 15:46:27 +0000</pubDate>
		<dc:creator>Lonnie</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nerd Stuff]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://blog.oneduality.com/?p=474</guid>
		<description><![CDATA[UPDATE: as of 11/30/2011 I have abandoned this all together, I use cleanmywall.net, or did until it went down .. you can now use this link for your cleaning needs. UPDATE: as of 12/13/2010 I have a greasemonkey script for firefox that works much better than this.. http://userscripts.org/scripts/show/92664 Continue reading if you want :) OK [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE: as of 11/30/2011 I have abandoned this all together, I use cleanmywall.net, or did until it went down .. you can now use <a href="http://cleanmywall.netbew.com/install.html">this link</a> for your cleaning needs.</p>
<p>UPDATE: as of 12/13/2010 I have a greasemonkey script for firefox that works much better than this.. <a href="http://userscripts.org/scripts/show/92664">http://userscripts.org/scripts/show/92664</a></p>
<p>Continue reading if you want :)</p>
<p>OK I won&#8217;t lie, this was cobbled together quickly .. and it will only delete so many at a time so you&#8217;ll need to run it a few times if you&#8217;ve got a lot of posts, I could make it so that it loops and deletes everything but I wanted to put it out there.</p>
<p>Use it at your own risk! if you get banned from facebook for automating something then that&#8217;s your own fault.. this is purely for educational purposes only and all that jazz =) *wink wink*<br />
Continue on reading!..</p>
<p><span id="more-474"></span>This code will log you in, go to m.facebook.com/minifeed.php and pull a list of stories then will loop through and delete them with a 5 second rest between deletes..  (less obvious) .. it also pretends to be firefox.</p>
<p>This requires WWW::Mechanize, HTTP::Cookies, HTML::Parser and HTML::TagParser .. ENJOY!</p>
<blockquote><p>#!/usr/bin/perl<br />
use WWW::Mechanize;<br />
use HTTP::Cookies;<br />
use HTML::Parser;<br />
use HTML::TagParser;</p>
<p>my $username = &#8220;user\@domain.com&#8221;;<br />
my $password = &#8220;password&#8221;;<br />
my $mech = WWW::Mechanize-&gt;new();</p>
<p>$mech-&gt;agent_alias( &#8216;Linux Mozilla&#8217; );<br />
$mech-&gt;cookie_jar(HTTP::Cookies-&gt;new());<br />
$mech-&gt;post(&#8220;https://login.facebook.com/login.php?m&amp;next=http://m.facebook.com/minifeed.php&#8221;,{email=&gt;$username,pass=&gt;$password});<br />
my $test = $mech-&gt;content();<br />
$mech-&gt;content() =~ /url=(.*?)&#8221;/;<br />
my $newurl = $1;</p>
<p>$mech-&gt;get($newurl);</p>
<p>my $html = $mech-&gt;content();</p>
<p>my $parser = HTML::Parser-&gt;new( api_version =&gt; 3,start_h =&gt; [\&amp;start,"tagname, attr"], );<br />
my @links;<br />
sub start {<br />
my ($tag, $attr) = @_;<br />
if ($tag =~ /^a$/ and defined $attr-&gt;{href}) {<br />
return<br />
if ($attr-&gt;{href} =~ m!^http://! and $opts{r}); # exclude absolute url when -r<br />
return<br />
if ($attr-&gt;{href} !~ m!http://! and $opts{a});# exclude relative url when -a<br />
push @links, $attr-&gt;{href};<br />
}<br />
}<br />
$parser-&gt;parse($html);<br />
$parser-&gt;eof;</p>
<p>foreach $link (@links) {<br />
if ($link =~ /delete\.php/) {<br />
$mech-&gt;get(&#8220;http://m.facebook.com&#8221; . $link);</p>
<p>$html_p = HTML::TagParser-&gt;new( $mech-&gt;content() );<br />
@elem = $html_p-&gt;getElementsByTagName( &#8220;form&#8221; );<br />
$action = $elem[0]-&gt;getAttribute(&#8220;action&#8221;);</p>
<p>@elem = $html_p-&gt;getElementsByAttribute( &#8220;name&#8221;, &#8220;fb_dtsg&#8221; );<br />
$fb_dtsg = $elem[0]-&gt;getAttribute(&#8220;value&#8221;);</p>
<p>@elem = $html_p-&gt;getElementsByAttribute( &#8220;name&#8221;, &#8220;ministory_key&#8221; );<br />
$ministory_key = $elem[0]-&gt;getAttribute(&#8220;value&#8221;);</p>
<p>@elem = $html_p-&gt;getElementsByAttribute( &#8220;name&#8221;, &#8220;story_type&#8221; );<br />
$story_type = $elem[0]-&gt;getAttribute(&#8220;value&#8221;);</p>
<p>@elem = $html_p-&gt;getElementsByAttribute( &#8220;name&#8221;, &#8220;profile_id&#8221; );<br />
$profile_id = $elem[0]-&gt;getAttribute(&#8220;value&#8221;);</p>
<p>@elem = $html_p-&gt;getElementsByAttribute( &#8220;name&#8221;, &#8220;confirm&#8221; );<br />
$confirm_id = $elem[0]-&gt;getAttribute(&#8220;value&#8221;);</p>
<p>print &#8220;Deleting mini story key: $ministory_key..\n&#8221;;<br />
$mech-&gt;post(&#8220;http://m.facebook.com&#8221; . $action,<br />
{fb_dtsg=&gt;$username,<br />
ministory_key=&gt;$ministory_key,<br />
story_type=&gt;$story_type,<br />
profile_id=&gt;$profile_id,<br />
confirm_id=&gt;$confirm_id});<br />
sleep(5);</p>
<p>}</p></blockquote>
<h4>Incoming search terms:</h4><ul><li>auto delete facebook posts</li><li>facebook auto remove posts</li><li>Facebook Auto Delete posts</li><li>perl facebook</li><li>fb_dtsg</li><li>automatically delete facebook posts</li><li>facebook auto delete</li><li>delete facebook wall</li><li>facebook perl</li><li>login facebook perl search</li></ul><!-- SEO SearchTerms Tagging 2 plugin took -0.084 ms -->]]></content:encoded>
			<wfw:commentRss>http://blog.oneduality.com/2010/05/06/use-perl-to-automatically-delete-your-facebook-wall-posts/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

