auto.js B0035 截取字符串 2021-10-22

  • 时间:
  • 浏览:
  • 来源:互联网
var city = "党员";
var r = http.get("http://www.syiban.com/search/index/init.html?modelid=1&q=" + city, {
    headers: {
        'Accept-Language': 'zh-cn,zh;q=0.5',
        'User-Agent': 'Mozilla/5.0(Macintosh;IntelMacOSX10_7_0)AppleWebKit/535.11(KHTML,likeGecko)Chrome/17.0.963.56Safari/535.11'
    }
});
log("code = " + r.statusCode);
// log("html = " + r.body.string());

var data = r.body.string()
log("=====================================")
log(data)

log("#########过滤 得到答案#############")
// var findAnsware = data.match(/<div class=\"yzm-news-right\">.*<div class=\"yzm-news-tags\">/);
// log(findAnsware)
// log(findAnsware[0])

log(data.slice(data.indexOf("yzm-news-right"), data.indexOf("yzm-news-tags")))


本文链接http://metronic.net.cn/metronic/show-64482.html