<!DOCTYPE html>
<html>
<head>
</head>
<body>
<? x= play(); ?>
<h1><?=x[0]; ?></h1>
<? for (s= 1; s < x.length; s++) {?>
<h2><?=x[s]; ?></h2>
<?}?>
</body>
</html>
function doGet(e) {
var template = HtmlService.createTemplateFromFile('index');
return template.evaluate()
.setTitle('練習')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
function play(){
var urlx="http://www.coara.or.jp/~cheerkey/mari/mari5.html";
str="";
try {
var res = UrlFetchApp.fetch(urlx);
str=res.getContentText("SJIS");
} catch (e) { Logger.log("Fail");}
for(s=1;s<400;s++){
str=str.replace("<BR>","〇");
}
str=clean_str(str);
var x=str.split("〇");
return x;
}
function clean_str(str){
sp=str;
for(kk=1;kk<250;kk++){
sp=fresh(sp);
}
return sp;
}
function fresh(strstr){
strstr=""+strstr;
p1=strstr.indexOf("<")
p2=-1;
if(p1>-1)p2=strstr.indexOf(">",p1)
k="";
if(p2>-1)k=strstr.substring(p1,p2)+">";
strxp=strstr.replace(k,"");
return strxp;
}
最終更新:2017年08月14日 08:10