MQTVKXWW 发表于 7 天前

发现地址

本帖最后由 MQTVKXWW 于 2025-6-27 15:23 编辑

@js:var htmlString = `
<p><span>分类:</span><a href="/sort/lastupdate_0_0_2_1.html" class="on">不限</a><a href="/sort/lastupdate_1_0_2_2.html" style="">玄幻修真</a><a href="/sort/lastupdate_2_0_2_2.html">重生穿越</a><a href="/sort/lastupdate_3_0_2_2.html">都市小说</a><a href="/sort/lastupdate_4_0_2_2.html">军史小说</a><a href="/sort/lastupdate_5_0_2_2.html">网游小说</a><a href="/sort/lastupdate_6_0_2_2.html">科幻小说</a><a href="/sort/lastupdate_7_0_2_2.html">灵异小说</a><a href="/sort/lastupdate_8_0_2_2.html">言情小说</a><a href="/sort/lastupdate_9_0_2_2.html">其他小说</a></p>
`;
var pattern = /<a\s+(?:[^>]*?\s+)?href="([^"]*)"[^>]*>([^<]*)<\/a>/g;
var matches;
var result = [];

while ((matches = pattern.exec(htmlString)) !== null) {
    var href = matches;
    var text = matches.trim();
   
    // 🎭替换🎭
    text = text
      .replace(/(..)../g, "$1")
    href = href
      .replace(/_\d.html/g, "_{{page}}.html")
   
    result.push(text + "::" + href);
}
result.join("&&");


@js:var htmlString = `
<li style=""> <a href="http://www.lingdks.com/fenl/1/1.html" title="零点小说玄幻小说" style="">玄幻小说</a></li>
<li> <a href="http://www.lingdks.com/fenl/2/1.html" title="零点小说仙侠小说">仙侠小说</a></li>
<li> <a href="http://www.lingdks.com/fenl/3/1.html" title="零点小说都市小说">都市小说</a></li>
<li> <a href="http://www.lingdks.com/fenl/4/1.html" title="零点小说历史军事">历史军事</a></li>
<li> <a href="http://www.lingdks.com/fenl/5/1.html" title="零点小说游戏竞技">游戏竞技</a></li>
<li> <a href="http://www.lingdks.com/fenl/6/1.html" title="零点小说科幻小说">科幻小说</a></li>
<li> <a href="http://www.lingdks.com/fenl/7/1.html" title="零点小说恐怖小说">恐怖小说</a></li>
<li> <a href="http://www.lingdks.com/fenl/8/1.html" title="零点小说其他类型">其他类型</a></li>
`;

var pattern = /<a\s+(?:[^>]*?\s+)?href="([^"]*)"[^>]*>([^<]*)<\/a>/g;
var matches;
var result = [];
while ((matches = pattern.exec(htmlString)) !== null) {
    var href = matches;
    var text = matches.trim();
   
    // 🎭替换🎭
    href = href
      .replace(/\d.html/g, "{{page}}.html")
      
    result.push({
      "title": text,
      "url": href,
      "style": {
            "layout_flexGrow": 1,
            "layout_flexBasisPercent": 0.2
      }
    });
}
JSON.stringify(result);

17508865 发表于 7 天前

感谢分享

rgm1988 发表于 7 天前

感谢分享
页: [1]
查看完整版本: 发现地址