CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
WWW::Mechanize - Change URL to extract from in ICECAST


New User

Mar 29, 2011, 12:16 AM

Post #1 of 1 (1011 views)
WWW::Mechanize - Change URL to extract from in ICECAST Can't Post

I got some help from someone to prepare this script. The script works on:

but I need it to work on:

The perl program:

#!/usr/bin/perl -w 
use WWW::Mechanize;
#$url = '';
$ice = '';

$url = $ARGV[0];
$m = WWW::Mechanize->new();
$c = $m->content;
@stations = $c =~ m{onclick=.javascript:pageTracker._trackPageview\(./stream/website.\)\;.>(.*?)</a></span>}gs
or die "Can't get station name\n";

@urls = $c =~ m{<span><a href=.(.*?)\"}gs
or die "Can't get urls\n";

@folder = $c =~ m{<p>\[ <a href=.(.*?)\"}gs
or die "Can't get streams\n";

foreach $folder (@folder){
push(@streams, $ice . $folder);

@inline_tags = $c =~ m{<ul class=.inline-tags.>(.*?)</ul>}gs
or die "Can't get Inline Tags\n";
foreach (@inline_tags) {
$_ =~ m{(.*?)<li><a href=.\/by_genre\/(.*?)\"}gs
or die "Can't get Playlist Streams\n";
push(@genre, $2);

$len = $#stations;

foreach (@streams) {
$d = $m->content;
push(@pl, $d);
foreach $num (0..$len){
print $stations[$num] . "," . $streams[$num] . "," . $urls[$num] . "," . $genre[$num] . "," . $pl[$num] . "\n\n\n";

Usage: for i in `cat icecastpages_mp3.txt`; do ./icecast-1.02 "$i"; done >>csvimportfile

1. On icecast-1.02.txt.txt, remove both txt extensions and make file executable.

2. Usage: for i in `cat icecastpages_mp3.txt`; do ./icecast-1.02 "$i"; done >>csvimportfile #will work fine and give output

3. However I need to run (but get error messages):
for i in `cat icecastpages_genre.txt`; do ./icecast-1.02 "$i"; done >>csvimportfile

The difference in the text files is the url as stated at the beginning of this post.

Can someone fix this to work on icecastpages_genre.txt?

Attachments: icecast-1.02.txt.txt (1.46 KB)
  icecastpages_mp3.txt (0.26 KB)
  icecastpages_genre.txt.txt (0.25 KB)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives