Thehotfix.net Logo                              To the forums          

How to ADD MySpace Friend Automatically

This page will be the permanent home of GlitchCastFriendAdder, a perl script I wrote to scratch an itch. I wanted to promote our music podcast, “The GlitchCast” by inviting fans of bands my wife and I like, as well as other podcasts we’re similar to and admire, to be our friends. The only problem is that in order to add people, you have to go through their profile pages, which are loaded with music, video, graphics, and crazy html. It can be a slow and tedious process. I wanted something that made it easy to invite groups of people.

With that in mind, I give you GlitchCastFriendAdder. 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.

Download GlitchCastFriendAdder 1.2

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

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.

GlitchCastFriendAdder - The Open Source MySpace Friend Adder

 

Thanks to http://www.glitchnyc.com/?page_id=117 for this how-to. Please take note that this how-to may be breaking my-space's rules, and may result in a/cs being banned. Please take note that thehotfix.net will not be held responsible if such a case do happen.