kennsaku

function myFunction() {
 
  word=ecl.EscapeSJIS("さだまさし")
 
 
 
   uu="http://www.oricon.co.jp/search/result.php?types=artist&search_string="+word;
 
 
       try {
 
 var response = UrlFetchApp.fetch(uu);
 str=response.getContentText("SJIS");
 
    } 
    catch (e) {Logger.log("Fail")}
 
 
 
 
  p1=str.indexOf("</strong>を含む芸能人名</span></h3>");
 
p2=str.indexOf("lock-search-box bottom mb0",p1);
 
  str=str.substring(p1,p2);
 
 
  var x=str.split("\n");
 
 
 
  var code="";
        for(s=1;s<x.length;s++){
        h=0;
       if(x[s].indexOf("/prof/")>-1)h=h+1;
        if(code.length<1)h=h+1;
        if(h==2)code=x[s];
 
        }
 
  p1=code.indexOf("prof");
  p2=code.indexOf("\" ",p1);
  if(p1>-1)code=code.substring(p1,p2);
 
      Logger.log(code);  
 
 
 
 
 
 
}
 
最終更新:2017年04月21日 20:33