Changeset 591 for websites/ustreamer

Show
Ignore:
Timestamp:
10/21/07 21:49:58 (7 years ago)
Author:
otsune
Message:

websites/ustreamer/channel2json.cgi: refactoring regexp

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • websites/ustreamer/channel2json.cgi

    r568 r591  
    2525 
    2626my %scraper = ( 
    27     'usc' => 'src="http://ustream.tv/([^"]*?).usc"', 
    28     'irc' => 'name="channel" value="(\#[^,]*?)"', 
     27    'usc' => qr{src="http://ustream\.tv/([^"]*?)\.usc"}o, 
     28    'irc' => qr{name="channel" value="(\#[^,]*?)"}o, 
    2929); 
    3030 
     
    4040    $_ => channel2any($_, $mode)  
    4141} map { 
    42     $_ =~ s{http://www.ustream.tv/channel/}{}; $_  
     42    $_ =~ s{http://(?:www\.)?ustream.tv/channel/}{}; $_  
    4343} @channels; 
    4444 
     
    4848    my ($channel, $mode) = @_; 
    4949    my $content = channel_fetch($channel); 
    50     $content =~ m{ $scraper{$mode} }; 
     50    $content =~ $scraper{$mode}; 
    5151    return $1 ? $1 : undef; 
    5252}