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

  • Post author:
  • Post category:其他

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")))



版权声明:本文为weixin_33595571原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。