ec----------

2023-07-07 14:33:26 浏览数 (1)

2.正则获取标签 代码如下(示例):

代码语言:javascript复制
var url = "http://www.baidu.com/";
var x = http.httpGetDefault(url, 10 * 1000, {"User-Agent": "test"});
var a = x.match(/<span class="title-content-title">([sS]*?)</span>/g);
for (var i = 0; i < a.length; i  ) {
    logd(a[i])
}

3.正则获取内容 代码如下(示例):

代码语言:javascript复制
var url = "http://www.baidu.com/";
var x = http.httpGetDefault(url, 10 * 1000, {"User-Agent": "test"});
var a = x.match(/<span class="title-content-title">([sS]*?)</span>/g);
for (var i = 0; i < a.length; i  ) {
    var b = a[i].replace(/<span(.*)?>(.*)</span>(.*)/, '$2')
    logd(b)
}

0 人点赞