Alright check this: new script, adjusts for posts per page. Gives you a link that not only goes to the post's page, but also automatically scrolls to the post.
To run:
1. Save the script (say, "trophy_posts.pl").
2. Run with posts per page as the argument. I.e., if you're displaying 75 posts per page, run with "perl trophy_posts.pl 75". If you don't specify posts per page, it'll assume 10 posts per page.
use warnings;
use strict;
use LWP::Simple;
my $ppp = 10;
if (defined $ARGV[0])
{
$ppp = $ARGV[0];
}
my $thread_url = "http://gamrconnect.vgchartz.com/thread.php?id=42917&page=";
# First plat holders post is on 134.
my $page_num = 134;
my $post_num = 0;
while (1)
{
# Get the page.
my $page = get ("$thread_url$page_num");
# Loop exit condition. Past the last page, we just keep getting the last
# page. Check if we're stuck on a number.
if ($page =~ /<span id="selected"><a href="thread.php?id=42917&page=(d )">/)
{
if ($1 < $page_num)
{
last;
}
}
# Split page into posts.
my @posts = split (/end forum_post_wrap/, $page);
$post_num = 10 * ($page_num - 1);
for (my $i = 0; $i < @posts; $i )
{
$post_num ;
# Search for plat holder post.
if ($posts[$i] =~ /<div id=".*">(<.*>)?(.*) - Platinum Trophy Holders/)
{
# Get game name.
my $game = $2;
$game =~ s/^s |s $//g;
# Get post URL.
$posts[$i] =~ /onClick="location.href='(.*)'"/;
my $post_url = $1;
# Get post's page url, after adjusting for posts per page.
my $adjusted_page = int (($post_num - 1)/ $ppp) 1;
my $adjusted_post = $post_num % $ppp;
if ($adjusted_post == 0)
{
$adjusted_post = $ppp;
}
print "Game: $gamen";
print "Post URL: $post_urln";
print "Page URL: $thread_url$adjusted_page#$adjusted_postn";
print "n";
}
}
$page_num ;
}
PSN: chenguo4
Current playing: No More Heroes







