GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  WWW::MYSPACE::COMMENT (3)

.ds Aq ’

NAME

WWW::Myspace::Comment - Auto-comment your MySpace friends from Perl scripts

CONTENTS

VERSION

Version 0.16

WARNING

March 2007: Using WWW::Myspace for commenting, messaging, or adding friends will probably get your Myspace account deleted or disabled.

SYNOPSIS

Simple module to leave a comment for each of our friends. This module is an extension of the Myspace module.

my $myspace = new WWW::Myspace;

my $comment = WWW::Myspace::Comment->new( $myspace );

my $result = $comment->post_comments( Just stopping by to say hi! );

Due to MySpace’s security features, the post_comments method will, by default, post 50 comments each time it’s run. It logs the result of each posting in a file so that it can be re-run daily without duplicating posts. The file defaults to $myspace->cache_dir/commented. It also checks each friend’s profile page before posting to make sure we haven’t already left a comment there. This also prevents duplicates, but is mostly designed to preserve posts (see note below).

See the documentation for the post_comments method below for an example script to comment all friends using a loop.

Also see the comment_myspace script that is installed with the distribution.

METHODS

new( CW$myspace )

Initialze and return a new WWW::Myspace::Comment object. $myspace is a WWW::Myspace object.

Example

use WWW::Myspace; use WWW::Myspace::Comment;

my $myspace = new WWW::Myspace;

my $comment = WWW::Myspace::Comment->new( $myspace );

    message

Retreives/sets the message we’re going to leave as a comment.

    friend_ids

Retreives/sets the list of friendIDs for whom we’re going to leave comments.



 $message->friend_ids( 12345, 12347, 123456 ); # Set the list of friends

 @friend_ids = $message->friend_ids; # Retreive the list of friends



    exclusions

Returns a list of the friends we’re not going to comment (because we already have). Returns the list in numerical order from lowest to highest. You probably only need this method for communicating with the user. Note that the post_comments method will also skip people with a link to our profile (i.e. in a comment) on their page. The exclusions list is 1) a safety that stops us from re-posting to pages that need to approve comments, 2) prevents us from having to read hundreds of profiles every time we run.

Example

( @exluded_friends ) = $comment->exclusions;

    commented

Returns a reference to a hash of friendIDs we’ve commented and the status of the attempted commenting. Reads the data from the exclusions cache file if it hasn’t already been read.

    cache_file

Sets or returns the cache filename. This defaults to commented in the myspace object’s cache_dir ($myspace->cache_dir/commented).

For convenience this method returns the value in all cases, so you can do this:

$cache_file = $commented->cache_file( /path/to/file );

    exclusions_file

This is a shortcut to cache_file, which you should use instead. exlucsions_file is here for backwards compatibility.

    max_count

Sets or returns the number of comments we should post before stopping. Default: 50.

Call max_count( 0 ) to disable counting. This is good if you can handle CAPTCHA responses and you want to stop only when you get a CAPTCHA request (i.e. if you’re running from a CGI script that can pass them back to a user).

    html( [1] [0] )

Sets to display HTML-friendly output (only really useful with noisy turned on also).

Call html(1) to display HTML tags (currently just BR tags). Call html(0) to display plain text.

Text output (html = 0) is enabled by default.

Example

$comment->html( 1 );

    delay_time

Sets the number of seconds for which the post_all method will sleep after reaching a COUNTER or CAPTCHA response. Defaults to 86400 (24 hours).

    noisy( [1] [0] )

Retreives/Sets noisy output. That is, print status messages for each post. If html(1) is called first, BR tags will be placed after each line so you can display it as, say, the output of a CGI script.

If noisy is off, the post_comments method will run silently until it hits a CAPTCHA response or until it hits its max_count.

set_noisy is off (0) by default.

    set_noisy

Shortcut for noisy, which you should use instead. set_noisy is here for backwards compatibility.

    interactive

If set to 1, and running on MacOS X, will pop up a CAPTCHA image in Preview and prompt the user to enter it. (not yet implemented).

    myspace

Sets/retreives the myspace object with which we’re logged in. You probably don’t need to use this as you’ll pass it to the new method instead.

post_comments( [ CW$message ], [ CW@friend_ids ] )

Posts comments to friends specified by @friend_ids. If none are given, post_comments retrieves the list of all friends using the WWW::Myspace object’s get_friends method.

post_comments will automatically skip all friendIDs in the exclusions list (see the exclusions method above). It will also scan each profile page before posting, and if a link to our profile exists on the page, it will not post. It will post until it has posted max_count successful posts, or until it receives a CAPTCHA request (please enter the characters in the image above).

post_comments returns a status string indicating why it stopped: CAPTCHA if a CAPTCHA image code was requested. COUNTER if it posted max_count comments and stopped. DONE if it posted everywhere it could.

Example

The following script will send the message Hi! to all of your friends, and then reset the exlusions file.



 use WWW::Myspace;
 use WWW::Myspace::Comment;

 my $myspace = new WWW::Myspace;

 my $comment = WWW::Myspace::Comment->new( $myspace );
 my $response = "";

 # Were sending a message, doesnt matter if weve posted before
 $comment->ignore_duplicates(1);

 # Post our comment until were done - may take several days if were
 # popular.
 while ( 1 ) {
        $response = $comment->post_comments( "Hi!" );
        last if ( $response eq "DONE" );
       
        if ( $response eq "CAPTCHA" ) {
       
                #[ do nothing, or get the form, post it yourself, and continue ]
                #( Hint: the page is in $myspace->{current_page}->content )
        }

        # (If response is CAPTCHA or COUNTER, we wait then continue
        # until were done). Note that you can probably sleep for 12 hours
        # instead of 24.
        sleep 24*60*60; #Sleep for a day, or run using cron
 }

 # Were done sending this message - reset the exclusions file
 # completely.
 $comment->reset_exclusions(all);



Note that because of the log post_comments keeps, this script could be interrupted and restarted without re-posting anyone.

Example 2

This script will make sure you’ve always got a comment on your friend’s pages.



 use WWW::Myspace;
 use WWW::Myspace::Comment;

 my $myspace = new WWW::Myspace;

 my $comment = WWW::Myspace::Comment->new( $myspace );
 my $response = "";

 # Post our comment until were done - may take several days if were
 # popular.
 while ( 1 ) {
        $response = $comment->post_comments( "Hi!" );
       
        if ( $response eq "DONE" ) {
                # Were done sending this message - reset the exclusions
                # file, except for people who approve their comment posts.
                # This causes us to start over, posting only if we dont
                # already have a comment on their page (i.e. if its been
                # pushed off).
                $comment->reset_exclusions;
                last;
        }
               
        # (If response is CAPTCHA or COUNTER, we wait then continue
        # until were done). Note that you can probably sleep for 12 hours
        # instead of 24.
        sleep 24*60*60; #Sleep for a day, or run using cron
 }

 # (Also see post_all below, which implements this loop).



    post_all

This convenience method implements the while loop script example in the post_comments section above. If the response is DONE, it exits. Otherwise, it sleeps for the number of seconds set in delay_time and calls post_comments again. It repeats this until it receives DONE from the post_comments method. post_all does NOT reset the exclusions file. If delay_time is 0, it returns instead of sleeping.

Returns the response code it gets from post_comments, which will always be DONE unless delay_time is set to 0, in which case it could be any of the codes returned by post_comments.

EXAMPLE use WWW::Myspace;
use WWW::Myspace::Comment;



 my $comment = new WWW::Myspace;
 my $comment = new WWW::Myspace::Comment( $myspace );

 # Send the message
 $comment->message("This is a great message wraught with meaning.");
 $comment->friend_ids( $myspace->get_friends );
 $comment->post_all;

 # Or

 # Send the message
 $comment->post_all( "This is a great message", $myspace->get_friends );



    ignore_duplicates( [ 1 | 0 ] )

By default post_comments will not post on a page if it detects that a previous comment by the user as whom it’s logged in has been posted there. If you call:

$comment->ignore_duplicates(1)

before calling post_comments, it will post without checking the page for previous comments. It will still check the exclusions list however.

Call $comment->ignore_duplicates(0) to return to checking for comments before posting (this is the default).

Use this option if you’re posting a new, specific comment (like Merry Christmas, Check out my new album) and you don’t care if there’s already another comment by you on people’s pages.

    reset_exclusions

    reset_exclusions( ’all’ )

Resets the exclusions file, leaving only friends with PA (posted, requires approval) status. If called with all, resets the entire file.

The reason for leaving friends with PA status is probably best described with an example. Say you have 700 friends. You want to hit each of their pages with Just stopping by to say hi!. So you set your comment script to run every day at 11am until you get a return status of DONE (with 700 friends that’d take 14 days). After that you want to keep running the script, posting only to pages that your comment has dropped off of. Conveniently, post_comments will do that for you by default. So you call reset_exclusions. If someone requires comments to be approved, your comment might not appear on their page (yet). If you keep the script running daily, resetting exlusions (because it’d hit DONE every day), you’d spam that poor person every day. So, by default, reset_exclusions will clear everything EXCEPT friends that approve comments.

If you want to override that behavior, call reset_exclusions( ’all’ ). You’d use this if, for example, you were sending a specific comment to all of your friends (i.e. Merry Christmas or Check out my new album!). It doesn’t matter if you then send another comment. In this case, you probably want to call ignore_duplicates(1) also.

SEE ALSO

perldoc comment_myspace - The comment_myspace script is installed with the WWW::Myspace distribution and uses this module.

AUTHOR

Grant Grueninger, <grantg at cpan.org>

BUGS

Please report any bugs or feature requests to bug-www-myspace at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Myspace>. I will be notified, and then you’ll automatically be notified of progress on your bug as I make changes.

KNOWN ISSUES

NOTES

CAPTCHA: WWW::Myspace allows 50 to 55 posts before requiring a CAPTCHA response, then allows 3 before requiring it again. Not sure what the timeout is on this, but running 50 a day seems to work.

Note that the main points of leaving comments are:



  - Keep ourselves in our fans memory,
  - Be "present" in as many places as possible.



We want to appear to be everywhere. Since we can only post to about 50 pages a day, we maximize our exposure by checking each page we’re going to post on to see if we’re already there and skipping it if we are.

TO DO



  - Provide a CGI interface so band members can
    coordinate and type in the CAPTCHA code. Interface
    would act as a relay: for each person wed auto-post
    to, display the filled in comment form and have them
    customize it and/or fill in the captcha code. Could run
    in semi-automatic mode where itd only display the page
    for them if it got a code request.



SUPPORT

You can find documentation for this module with the perldoc command.



    perldoc WWW::Myspace::Comment



You can also look for information at:
o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/WWW-Myspace>

o CPAN Ratings

<http://cpanratings.perl.org/d/WWW-Myspace>

o RT: CPAN’s request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Myspace>

o Search CPAN

<http://search.cpan.org/dist/WWW-Myspace>

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2005, 2006 Grant Grueninger, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 WWW::MYSPACE::COMMENT (3) 2008-06-19

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.