#!/usr/bin/perl # Print all tw.myblog.yahoo.com subscriptions URLs from a given URL # Copyright : http://www.fsf.org/copyleft/gpl.html # Author : Dan Jacobson -- http://jidanni.org/ # Created On : Sun Dec 19 21:41:47 2010 # Last Modified On: Sat Dec 25 10:31:18 2010 # Update Count : 58 use warnings FATAL => 'all'; use strict; use utf8; use open qw/:std :encoding(utf8)/; use WWW::Mechanize; my $mech = WWW::Mechanize->new( autocheck => 1 ); $mech->get(@ARGV); my %blogs; do { get_all_blogs_on_this_page() } while ( $mech->find_link( text_regex => qr'下一頁' ) # $ maybe added by my wwwoffle && $mech->follow_link( text_regex => qr'下一頁' ) ); print "$_\n" for sort keys %blogs; sub get_all_blogs_on_this_page { for ( $mech->find_all_links( tag => "a", text => '詳全文' ) ) { $_->url =~ shttp://tw.myblog.yahoo.com/jw!3tU21_aCAh6NNGlBu.pqLpgW/subscription?fid=3&page=6 $blogs{ $_->url }++; } }