Sunday, May 28, 2006

Adding friends to myspace using perl

By Justin Silverton

I came across this perl script today that allows you to add friends to your myspace account using perl.main website is HereTaken from the website: " This is a perl script, and it’s certainly rough around the edges. If you’re running on windows, there are applications available for cheap that will do the job better and with more support. I’m on Linux, so I needed a cross-platform script that did just what I needed.

That said, this little bit of code should run on any machine with the proper perl modules installed (WWW::Mechanize, HTML::TokeParser::Simple, and Text::CSV). It’s open source, released under the GPL."DownloadThe script can be found Here

How do I run this?

On Linux

If you’re running on Linux, running this code is fairly simple. Just invoke it with perl GlitchCastFriendAdder.pl

If it complains that it’s needs certainly libraries, you can add them with CPAN, apt, or yum.
To add the necessary libraries using apt on Fedora Core, Red Hat, CentOS, Debian, Ubuntu, and others, run this command as root: (package names may differ slighly across distros. If one does not appear available, search for it with apt-cache search packagename) apt-cache search mechanize
brings up libwww-mechanize-perl
apt-cache search tokeparser
brings up libhtml-tokeparser-simple-perl
apt-cache search csv-perl
brings up libtext-csv-perl
now that I’ve found the package names (I’m using ubuntu, so this exact command should work for all debian distros with universe and multiverse enabled)
apt-get install libhtml-tokeparser-simple-perl libtext-csv-perl libwww-mechanize-perl
You could of course use CPAN to install these modules instead, but I’m less familiar with that method. If you know how, please email me at GlitchCastFriendAdder A.T. GlitchNYC.com Now that you’ve got all your modules, the code should run just fine. Be sure that you’ve added at least one MySpace URL to friendPagesToScrape.txt - you’ll have to make that file if you haven’t already.

Running on a Mac

I have no idea. In theory, this should be fairly similar to the process above. If you get it to work, let me know how you did it!

Running on Windows

This should be possible using ActiveState perl. It’s been a while since I used it, but if memory serves, there is a GUI that allows you to choose the packages you need. Just select these: * WWW::Mechanize * HTML::TokeParser::Simple * Text::CSV
I’ve now had my first report of this working on windows! To get the firefox captcha routine to work, you’ll need to change the firefox executable path. This is as simple as commenting one line and uncommenting another. It’s right below the username and password at the top of the code.

Running the script

First, enter your username and password at the top of the script
Second, paste a bunch of myspace url’s containing people you want to add into the file friendPagesToScrape.txt in the same directory where the main script is.
UPDATE: The URLs should be one per line! (this is a change from version 1.0)
HINT - It’s easy to change just the “page” variable when you paste in the url’s to get multiple pages of friends of one group/person.

The script will parse that file, and then go to each page in the list, getting all the friend IDs on the page. Once it has grabbed all the friendIDs, it adds each of the friends, prompting you if it needs a captcha. I’ve tuned it to be fairly patient (1 friend added every 5 seconds or so) so as to not anger the myspace gods and incur lots of captchas, but you can tune as it runs by following the prompts if you start to get too many captchas.


Post a Comment

Links to this post:

Create a Link

<< Home