编辑代码

//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
jq311(".js-goods-list a").each(function (index, item) {
    var url_head = "https://www.temu.com/";
    var full_url = url_head + jq311(item).attr("href");
    console.log(full_url);
});
window.temu_all_user_contents = []
window.begin_get_all_data = setInterval(function () {
    if (jq311("._244ldJXl a").length > 0) {
        jq311("._244ldJXl a").each(function (index, item) {
            var one_item = []
            var url_head = "https://www.temu.com/";
            var full_url = url_head + jq311(item).attr("href");
            var user_name = jq311(item).parent().prev().text();
            var score = jq311(item).parent().next().attr("aria-label");
            var size_color = jq311(item).parent().next().next().text();
            var overall_fit = jq311(item).parent().next().next().next().text();
            var content = jq311(item).parent().parent().children(".N4fQ1-w3").text();
            var herfs = []
            jq311(item).parent().parent().find("._17EhhWj_").each(function (index2, item2) {
                herfs.push(jq311(item2).attr("src"))
            });
            herfs.join(".")
            one_item.push(full_url);
            one_item.push(user_name);
            one_item.push(score);
            one_item.push(size_color);
            one_item.push(overall_fit);
            one_item.push(content);
            one_item.push(herfs.join("$##$"));
            window.temu_all_user_contents.push(one_item.join("@@###@@"))
            console.log(one_item);
        });
        console.log(window.temu_all_user_contents.length);
        if (jq311(jq311("li[title='next page'] div")[1]).attr("disabled") == 'disabled') {
            clearInterval(window.begin_get_all_data);
        }
        jq311(jq311("li[title='next page']")[1]).click();
    }
}, 1000);


clearInterval(window.begin_get_all_data);


jq311("div[class^='body-module__footer']");
function convertArrayOfObjectsToCSV(arr) {
    const separator = '@@###@@';
    const keys = Object.keys(arr[0]);
    const csvHeader = keys.join(separator);

    const csvRows = arr.map((obj) => {
        return keys.map((key) => {
            return obj[key];
        }).join(separator);
    });

    return `${csvHeader}\n${csvRows.join('\n')}`;
}