r25775 - in /trunk/libwww-myspace-perl: Changes META.yml debian/changelog lib/WWW/Myspace.pm t/17-get_basic_info.t t/22-search-music.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Fri Oct 3 14:19:32 UTC 2008


Author: gregoa
Date: Fri Oct  3 14:19:29 2008
New Revision: 25775

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=25775
Log:
New upstream release.

Modified:
    trunk/libwww-myspace-perl/Changes
    trunk/libwww-myspace-perl/META.yml
    trunk/libwww-myspace-perl/debian/changelog
    trunk/libwww-myspace-perl/lib/WWW/Myspace.pm
    trunk/libwww-myspace-perl/t/17-get_basic_info.t
    trunk/libwww-myspace-perl/t/22-search-music.t

Modified: trunk/libwww-myspace-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-myspace-perl/Changes?rev=25775&op=diff
==============================================================================
--- trunk/libwww-myspace-perl/Changes (original)
+++ trunk/libwww-myspace-perl/Changes Fri Oct  3 14:19:29 2008
@@ -1,4 +1,16 @@
 Revision history for WWW::Myspace
+
+0.88    2008-10-01
+        - Fixed is_band to correctly detect music profiles, which broke due to
+          Myspace changes around 2008-09-30;  this was also causing
+          get_basic_info to fail to work with music profiles
+        - Fixed get_basic_info to return correct timestamps in 'lastlogin'
+          field, both for personal and music profiles
+        - New tests in t/17-get_basic_info.t check that that get_basic_info
+          returns a sensible 'lastlogin' timestamp for personal and music
+          profiles, and a sensible 'profileviews' for a band profile
+        - New tests in t/22-search_music.t check that multiple results pages
+          are read, and that spaces in search terms are properly escaped
 
 0.87    2008-09-12
         - New method captcha_handler allows a user-defined function to provide

Modified: trunk/libwww-myspace-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-myspace-perl/META.yml?rev=25775&op=diff
==============================================================================
--- trunk/libwww-myspace-perl/META.yml (original)
+++ trunk/libwww-myspace-perl/META.yml Fri Oct  3 14:19:29 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                WWW-Myspace
-version:             0.87
+version:             0.88
 abstract:            Access MySpace.com profile information from Perl
 license:             perl
 generated_by:        ExtUtils::MakeMaker version 6.36

Modified: trunk/libwww-myspace-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-myspace-perl/debian/changelog?rev=25775&op=diff
==============================================================================
--- trunk/libwww-myspace-perl/debian/changelog (original)
+++ trunk/libwww-myspace-perl/debian/changelog Fri Oct  3 14:19:29 2008
@@ -1,3 +1,9 @@
+libwww-myspace-perl (0.88-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Fri, 03 Oct 2008 16:18:33 +0200
+
 libwww-myspace-perl (0.87-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libwww-myspace-perl/lib/WWW/Myspace.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-myspace-perl/lib/WWW/Myspace.pm?rev=25775&op=diff
==============================================================================
--- trunk/libwww-myspace-perl/lib/WWW/Myspace.pm (original)
+++ trunk/libwww-myspace-perl/lib/WWW/Myspace.pm Fri Oct  3 14:19:29 2008
@@ -1,7 +1,7 @@
 #####################################################################
 # WWW::Myspace.pm
 # Sccsid:  %Z%  %M%  %I%  Delta: %G%
-# $Id: Myspace.pm 644 2008-09-12 20:12:40Z s-chamberlain $
+# $Id: Myspace.pm 647 2008-10-01 04:42:20Z s-chamberlain $
 ######################################################################
 # Copyright (c) 2005 Grant Grueninger, Commercial Systems Corp.
 #
@@ -43,11 +43,11 @@
 
 =head1 VERSION
 
-Version 0.87
-
-=cut
-
-our $VERSION = '0.87';
+Version 0.88
+
+=cut
+
+our $VERSION = '0.88';
 
 =head1 WARNING
 
@@ -191,13 +191,13 @@
     friend_link => qr/fuseaction=user\.viewprofile\&(amp;)?friendid=([0-9]+)/oism,
     friend_img  => qr/fuseaction=user\.viewprofile\&(amp;)?friendID=([0-9]+)[^<]+<\s*img\b[^<]+\bsrc\s*=\s*["']?(.*?)["'\s>]/oism,
     #friend_img  => qr/fuseaction=user\.viewprofile\&(amp;)?friendID=([0-9]+)["'\s>&][^<]*<\s*img\b[^<]+\bsrc\s*=\s*["']?(.*?)["'\s>]/oism,
-    is_band    => qr/fuseaction=bandprofile/ioxsm,
+    is_band    => qr/fuseaction=music\./ioxsm,  # 2008-09-30 -- changed from
+                                                #  fuseaction=bandprofile
     is_logged_in => qr/fuseaction=signout/io,
     is_private => qr/(This profile is set to private\. This user must add you as a friend to see his\/her profile\.)/io,
     is_invalid => qr/(Invalid Friend ID.<br>This user has either cancelled their membership, or their account has been deleted.)/io,
     is_comedy => qr/http\:\/\/.*?myspace\.com\/images\/comedy\/mscomedy\.gif/io,
     is_film => qr/http\:\/\/.*?myspace\.com\/images\/film_logo\.gif/io,
-    is_music => qr/http\:\/\/.*?myspace\.com\/images\/music_logo\.gif/io,
     last_login => qr/Last Login:/io,
     basic_info => qr/"Table2".*<td[^>]*>(.*Last Login:.*?)<br(?: \/)?>/smo,
     basic_info_band => qr/Arial, Helvetic, sans-serif"><strong>(.*Last Login:.*?)<br>/smo,
@@ -2215,16 +2215,17 @@
         $page = $self->_apply_regex( regex => 'basic_info', page => $page );
 
         # Parse text found between <br />'s, and trim whitespace
-        ( $info{'headline'},
-          undef,
-          $info{'gender'},
-          $info{'age'},
-          $info{'cityregion'},
-          $info{'country'},
-          undef,
-          undef,
-          undef,
-          $info{'lastlogin'}
+        (
+            $info{'headline'},
+            undef,
+            $info{'gender'},
+            $info{'age'},
+            $info{'cityregion'},
+            $info{'country'},
+            undef,
+            undef,
+            undef,
+            undef         # lastlogin, now obtained by last_login instead
         ) = split(/\s*<br(?: \/)?>\s*/ios, $page);
 
         # Strip quotes from around headline, if any
@@ -2235,8 +2236,9 @@
             or warn "get_basic_info:  failed to parse age\n";
 
         #return last login as date only
-        $info{'lastlogin'} =~ s/Last Login:\s*([0-9][0-9\/\-]+[0-9]).*/$1/ios
-            or warn "get_basic_info:  failed to parse lastlogin";
+        # There is already a last_login method for this, so we call that instead
+        #  of duplicating code here
+        $info{'lastlogin'} = $self->last_login
 
     }
     #separately for band profiles
@@ -2248,10 +2250,18 @@
         $page=~ s/(<br>)([^\s])/$2/g;
 
         #assign values and trim leading and trailing white spaces
-        ( $info{'headline'},undef,$info{'cityregion'},
-          $info{'country'},undef,$info{'profileviews'},
-          undef,undef,undef,$info{'lastlogin'}
-        )=map {s/^\s+//;s/\s+$//;$_} split('<br>',$page);
+        (
+            $info{'headline'},
+            undef,
+            $info{'cityregion'},
+            $info{'country'},
+            undef,
+            $info{'profileviews'},
+            undef,
+            undef,
+            undef,
+            undef       # lastlogin, now obtained by last_login instead
+        ) = map {s/^\s+//;s/\s+$//;$_} split('<br>',$page);
 
         # Strip quotes from around headline, if any
         $info{'headline'} =~ s/^\"(.*)\"$/$1/os;
@@ -2259,8 +2269,9 @@
         #make sure profile views returns only the number
         $info{'profileviews'}=~ s/[^\d]*([\d]+)/$1/sm;
 
-        #return last login as date only
-        $info{'lastlogin'} =~ s/Last Login:[^\d]*([\d\/]+)/$1/sm;
+        # There is already a last_login method for this, so we call that instead
+        #  of duplicating code here
+        $info{'lastlogin'} = $self->last_login
     }
 
     if ( $DEBUG )
@@ -2526,8 +2537,7 @@
     my $page = $self->_validate_page_request( @_ );
 
     #band profile
-    #return 2 if ( $page->decoded_content =~ qr/x\.myspace\.com\/images\/music_logo\.gif/o );
-    return 2 if($self->_apply_regex( regex => 'is_music', page => $page ));
+    return 2 if($self->_apply_regex( regex => 'is_band', page => $page ));
 
     #film profile
     #return 3 if ( $page->decoded_content =~ qr/x\.myspace\.com\/images\/film_logo\.gif/o );
@@ -3778,7 +3788,6 @@
 
         # Click "Next".
         $page_no++;
-        print "Getting page " . $page_no . "\n";
         $self->submit_form( {
             'form_name' => 'PageForm',
             no_click => 1,

Modified: trunk/libwww-myspace-perl/t/17-get_basic_info.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-myspace-perl/t/17-get_basic_info.t?rev=25775&op=diff
==============================================================================
--- trunk/libwww-myspace-perl/t/17-get_basic_info.t (original)
+++ trunk/libwww-myspace-perl/t/17-get_basic_info.t Fri Oct  3 14:19:29 2008
@@ -1,6 +1,6 @@
 #!perl -T
 
-use Test::More tests => 15;  # SEE FOREACH LOOP BLOW
+use Test::More tests => 18;  # SEE FOREACH LOOP BLOW
 #use Test::More 'no_plan';
 
 use lib 't';
@@ -20,9 +20,21 @@
     ok( $info{"$key"}, "individual: get_basic_info $key : $info{\"$key\"}" );
 }
 
+# Myspace began around 2003, last login should be after that time
+ok ( $info{'lastlogin'} >= 1041379200 , 'Last login is 2003 or later' );
+
+
 #bandprofile
 ( %info ) = $myspace->get_basic_info( 3327112 );
 # If you change the number of keys here, change the number of tests above.
 foreach my $key ( 'country', 'cityregion', 'city', 'region','headline','profileviews', 'lastlogin' ) {
     ok( $info{"$key"}, "band: get_basic_info $key : $info{\"$key\"}" );
 }
+
+# 2008-09-21 -- today the band's last login was 2008-09-21 (1221955200), so
+#  check that the last login is now greater or equal to that date
+ok( $info{'lastlogin'} >= 1221955200, 'Last login is 2008-09-21 or later' );
+
+# 2008-09-21 -- today the band's profile views were 12908038, so check that
+#  the profile views are now greater or qual to that value
+ok( $info{'profileviews'} >= 12908038, 'Profile views are 12908038 or more'  );

Modified: trunk/libwww-myspace-perl/t/22-search-music.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-myspace-perl/t/22-search-music.t?rev=25775&op=diff
==============================================================================
--- trunk/libwww-myspace-perl/t/22-search-music.t (original)
+++ trunk/libwww-myspace-perl/t/22-search-music.t Fri Oct  3 14:19:29 2008
@@ -1,7 +1,7 @@
 #!perl -T
 
 #use Test::More 'no_plan';
-use Test::More tests => 3;
+use Test::More tests => 5;
 use strict;
 
 use WWW::Myspace;
@@ -67,5 +67,25 @@
         or diag $note_third_party_profile;
 
 
-    # :TODO: test that multiple results pages are correctly handled
+    # Search with a search term containing a space
+    my $spaced_band_name = "two words";
+
+    my @spaced_band_results = $myspace->search_music( {
+        search_term => 0,
+        keywords => $spaced_band_name
+    });
+
+    # If the search term is properly URI-escaped, there should be some results
+    ok ( scalar @spaced_band_results >= 1,
+         "Expect at least one result for a search term containing a space" )
+        or diag $note_third_party_profile;
+
+
+    # The previous search term actually produces 3 pages of results (10 per
+    #  page), so we should expect more than 10 results, if multiple pages are
+    #  being read correctly
+    ok ( scalar @spaced_band_results > 10,
+         "Expect at least 10 results when there are multiple pages" )
+        or diag $note_third_party_profile;
+
 }




More information about the Pkg-perl-cvs-commits mailing list