Changeset 7436 for websites/ustreamer

Show
Ignore:
Timestamp:
03/04/08 00:26:51 (5 years ago)
Author:
drry
Message:

websites/ustreamer/channel2json.cgi
websites/ustreamer/onairstatus2json.cgi
websites/ustreamer/index.html
websites/ustreamer/js/ustreamer.js:

  • www.ustream.tv が優先になったようなので追随して変更をしました。
Location:
websites/ustreamer
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • websites/ustreamer/channel2json.cgi

    r7010 r7436  
    2525 
    2626my %scraper = ( 
    27     'usc' => qr{src="http://ustream\.tv/([^"]*?)\.usc"}o, 
     27    'usc' => qr{src="http://(?:www\.)?ustream\.tv/([^"]*?)\.usc"}o, 
    2828    'irc' => qr{chat_so\.addVariable\('channel', '#([^']*?)'\);}o 
    2929); 
     
    3838 
    3939my %result = map { 
    40     $_ => channel2any($_, $mode)  
     40    $_ => channel2any($_, $mode) 
    4141} map { 
    42     $_ =~ s{http://(?:www\.)?ustream.tv/channel/}{}; $_  
     42    $_ =~ s{http://(?:www\.)?ustream.tv/channel/}{}; $_ 
    4343} @channels; 
    4444 
     
    5757    my $ua = LWP::UserAgent->new; 
    5858    $ua->agent('ustream2json/0.01'); 
    59      
     59 
    6060    my $res = URI::Fetch->fetch( 
    6161        $url, 
     
    7272    my ($q, $obj) = @_; 
    7373    print $q->header( 
    74         "-type" => "text/javascript", 
     74        "-type" => "application/json", 
    7575        "-charset" => 'utf-8' 
    7676    ); 
  • websites/ustreamer/index.html

    r303 r7436  
    4747<div style="clear: both;"></div> 
    4848 
    49 <form onsubmit="if (this.url.value) { addBuddyFromURL('http://ustream.tv/channel/'+this.url.value) } return false"> 
    50 add Channel: http://ustream.tv/channel/<input size="30" name="url" value="" type="text" onfocus="this.select()"> <input value="add" type="submit"> 
     49<form onsubmit="if (this.url.value) { addBuddyFromURL('http://www.ustream.tv/channel/'+this.url.value) } return false"> 
     50add Channel: http://www.ustream.tv/channel/<input size="30" name="url" value="" type="text" onfocus="this.select()"> <input value="add" type="submit"> 
    5151</form> 
    5252<textarea id="linkcode" cols="30" rows="1" style="width:100%;height:1.5em;overflow:hidden" onfocus="this.select()"> </textarea> 
  • websites/ustreamer/js/ustreamer.js

    r4240 r7436  
    88var init_load_limit = 3; 
    99 
    10 var use_innerhtml = (navigator.userAgent.match(/Safari/) || window.opera) ? true : false; 
     10var use_innerhtml = navigator.userAgent.indexOf("Safari") != -1 || window.opera; 
    1111var buddies = []; 
    1212var buddyEmbeds = []; 
     
    114114      // IRC 
    115115      if (use_innerhtml) { 
    116         container.innerHTML = ['<embed ', ' width="', current_width, '"', ' height="200"', ' type="application/x-shockwave-flash" ', ' flashvars="channel=#', buddy.name, '" ', ' src="http://ustream.tv/IrcClient.swf" ', ' title="', buddy.name, '"/>'].join(""); 
     116        container.innerHTML = ['<embed ', ' width="', current_width, '"', ' height="200"', ' type="application/x-shockwave-flash" ', ' flashvars="channel=#', buddy.name, '" ', ' src="http://www.ustream.tv/IrcClient.swf" ', ' title="', buddy.name, '"/>'].join(""); 
    117117      } 
    118118      else { 
     
    120120        el.width = current_width; 
    121121        el.height = 200; 
    122         el.src = "http://ustream.tv/IrcClient.swf"; 
     122        el.src = "http://www.ustream.tv/IrcClient.swf"; 
    123123        el.type = "application/x-shockwave-flash"; 
    124124        el.wmode = "transparent"; 
     
    130130    caption = document.createElement('div'); 
    131131    caption.className = "caption"; 
    132     caption.innerHTML = "<a href='http://ustream.tv/watch/channel/" + buddy.id + "' target=_blank>" + buddy.name + '</a> '; 
     132    caption.innerHTML = "<a href='http://www.ustream.tv/watch/channel/" + buddy.id + "' target=_blank>" + buddy.name + '</a> '; 
    133133    container.appendChild(caption); 
    134134    return container; 
     
    158158function addBuddyFromURL(url) { 
    159159  var api = path_to_api + '?channel_name='; 
    160   var channel_name = url.replace(/http:\/\/(www\.)?ustream.tv\/channel\//, ""); 
     160  var channel_name = url.replace(/http:\/\/(?:www\.)?ustream\.tv\/channel\//, ""); 
    161161  if (document.getElementsByName(channel_name)[0]) { 
    162162    return; 
     
    189189    addNewEmbed({ name : target.getAttribute("name"), id : id }); 
    190190    if ( target.childNodes[0].alt.match(/^other-(.*)/)) { 
    191       addBuddyFromURL("http://ustream.tv/channel/" + RegExp.$1); 
     191      addBuddyFromURL("http://www.ustream.tv/channel/" + RegExp.$1); 
    192192    } 
    193193  } 
     
    338338  var ticker = document.getElementById("ticker"); 
    339339  var entryContent = entryContents[count]; 
    340   channelURLs = entryContent.match(/http:\/\/(www\.)?ustream.tv\/channel\/([0-9a-zA-Z_-]*)/); 
     340  channelURLs = entryContent.match(/http:\/\/(?:www\.)?ustream\.tv\/channel\/([0-9a-zA-Z_-]+)/); 
    341341  if (channelURLs) { 
    342342    channelURL = channelURLs[0]; 
    343     channelName = channelURLs[2]; 
     343    channelName = channelURLs[1]; 
    344344  } 
    345345  message += entryContent.charAt(count++); 
  • websites/ustreamer/onairstatus2json.cgi

    r141 r7436  
    3636 
    3737my %result = map { 
    38     $_ => onair($_)  
     38    $_ => onair($_) 
    3939} map { 
    40     $_=~s{http://www.ustream.tv/channel/}{}; $_  
     40    $_=~s{http://www.ustream.tv/channel/}{}; $_ 
    4141} @channels; 
    4242 
     
    4949    my $ua = LWP::UserAgent->new; 
    5050    $ua->agent('onairstatus2json/0.01'); 
    51      
     51 
    5252    my $res = URI::Fetch->fetch( 
    5353        $url, 
     
    7575    my $ua = LWP::UserAgent->new; 
    7676    $ua->agent('onairstatus2json/0.01'); 
    77      
     77 
    7878    my $res = URI::Fetch->fetch( 
    7979        $url, 
     
    9292    my ($q, $obj) = @_; 
    9393    print $q->header( 
    94         "-type" => "text/javascript", 
     94        "-type" => "application/json", 
    9595        "-charset" => 'utf-8' 
    9696    );