On Thu, Apr 3, 2008 at 5:10 PM, Mark Wagner <[EMAIL PROTECTED]> wrote:
> On 4/3/08, Jim <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  >  I am trying to write a PERL script to retrieve a couple of podcasts
>  >  per week.
>  >
>  >  Using use XML::RSS::TimingBot I can retrieve and print the .rss file,
>  >  but how do I extract the actual mp3 URL from $response->content?
>
>  Using a suitable regular expression.  Without knowing what
>  $response->content contains, I can't be sure if there's a better
>  solution, but
>
>  my ($url) = $response->content =~ /http:\S?\.mp3/;
>
>  should work.
>
snip

I believe you are missing a + in your regex

my ($url) = $response->content =~ /http:\S+?\.mp3/;

and a regex is not necessarily the best way to parse HTML (consider
using HTML::Parser* or one if the other modules on CPAN).  In addition
you will need to retrieve the mp3 file using the get function from
LWP::Simple** or some other module.

* http://search.cpan.org/~gaas/HTML-Parser-3.56/Parser.pm
** http://search.cpan.org/~gaas/libwww-perl-5.808/lib/LWP/Simple.pm

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to