代码拉取完成,页面将自动刷新
xhrListen(),
zsl.ready(function(){console.log("我是temu入口函数");var[t,e]=zsl.objReflectValue(crxConfig,["serverConfig","cs","temu","popup","status"]);if(!t||!e)return!1;const p=(t,e)=>{smartCreateDom(e.pro_img,!0,{cspProxy:!0})},h=(()=>{var t={us:{site:"us",siteStat:"https://hm.baidu.com/hm.js?e3ba231b72303bbd69fcfc9ac717d629"},uk:{site:"uk",siteStat:"https://hm.baidu.com/hm.js?e3ba231b72303bbd69fcfc9ac717d629"},de:{site:"de",siteStat:"https://hm.baidu.com/hm.js?e3ba231b72303bbd69fcfc9ac717d629"}};let e="us",a={76:"de",211:"us",210:"uk",69:"fr",100:"jp",12:"au"};var o=zsl.cookieToObj(document.cookie);return t[e=o&&o.region&&a[o.region]?a[o.region]:e]||t.us})(),n={bought_avg_1:"昨日销量",bought_avg_3:"3日日均销量",bought_avg_7:"7日日均销量",bought_increase_3:"3日日均增幅",bought_increase_7:"7日日均增幅",generation_time:"上架时间"};function g(t){if(zsl.isEmpty(t))return null;let e=!0;if(zsl.isPlainObject(t)&&(e=!1,t=[t]),!Array.isArray(t))return null;let s={};return zsl.each(t,function(t,a){let o=[];zsl.each(a,function(t,e){n.hasOwnProperty(t)&&o.push({dt_text:n[t],dt_attrs:{title:n[t]},dd_text:e,dd_attrs:{title:e},dd_link:crxConfig.home+"/temu/product/info/pro_id/"+a.pro_id+"/country/"+h.site})}),s[a.pro_id]={data:o,rawData:a}}),e?s:Object.values(s)[0]}function a(){o()}function o(){let t=zslQ('.autoFitList[role="region"] div[data-tooltip^="goodContainer"]');if(zsl.isEmpty(t))return setTimeout(o,3e3),!0;let l={};t.each(function(t,e){if(!isPartiallyInViewport(e)||0<zslQ(e).find(".nmhj-inject").length)return!0;let a=zslQ(e),o=a.find("img.goods-img-external");zsl.isEmpty(o)||o.attr("src");let s=a.data("tooltip").toString();if(!/[^\d]+(\d+)/.test(s))return!0;s=RegExp.$1;let n=a.find('span[data-type="saleTips"]'),i=null,r=(zsl.isEmpty(n)||(i=n.children("span").first().text()),a.append(`<object class="nmhj-object"><div class="nmhj-inject" nmh-id="${s}"></div></object>`),a.find(`.nmhj-inject[nmh-id="${s}"]`).get(0));
r.addEventListener("click",function(t){t.stopPropagation()}),
zslRender(r,{template:"loading"}),
l[s]={id:s,sale:i}}),zsl.isEmpty(l)||
console.log(Object.values(l)),
ajax({
url:"temu/getProduct",
method:"post",
data:{ ids:zsl.pakoEncode(Object.values(l)),
referer:location.href,
site:h.site
},
responseType:"json"
}
)
.then(
t=>{0==t.code&&(t=g(t=zsl.parseApiData(t.data)),zsl.isEmpty(t)||zsl.each(t,function(t,e){l.hasOwnProperty(t)&&delete l[t],e.data.unshift({dt_text:"智能找货",dd_text:"寻找低价货源",dd_click:p}),zslRender('.nmhj-inject[nmh-id="'+t+'"]',{template:"temu",options:{getData:{state:!0,data:e.data},isList:!0,rawData:e.rawData}})})),zsl.each(l,function(t,e){zslRender('.nmhj-inject[nmh-id="'+t+'"]',{template:"msgTip",options:{text:"查询不到该产品数据,我们会尽快收录。没有销量的产品不被收录"}})})}
)
.catch(t=>{console.log("请求错误",t)})
.finally(()=>{}),setTimeout(o,1500)}function s(){!function(){let t=".baseContent nav",e="#main_scale .baseContent",a=document.querySelector(t);a||(t=".mainContent nav",e=".mainContent",a=document.querySelector(t));if(!a)return;let o=window.getComputedStyle(a).paddingTop,s=parseInt(o)+200,n=(zslQ("body").append(`<style>${t}{padding-top: ${s}px;}</style>`),a.getBoundingClientRect()),i=n.top<130?130:n.top,r=zslQ(a).closest(e).get(0);if(r){let t=new ResizeObserver(function(t){var e=a.getBoundingClientRect(),e=e.top<130?130:e.top;i!=e&&zslQ("div.zsl-detail").css("top",parseInt(e+5)+"px")});t.observe(r)}var l=["position: absolute","z-index: 100",`top: ${i+5}px`,`width: ${n.width}px`,"left: 50%","transform: translateX(-50%)","height: 180px","background-color: #fff"].join(";");let c=null;try{if(!(c=/-g-([\d]+)/.test(location.pathname)||/goods_id=([\d]+)/.test(location.search)?RegExp.$1:c))return}catch(t){return}let d=zslQ('div[aria-label*="sold,"]'),m=null;0<d.length&&d.text()&&(u=d.text().split("sold"),m=zsl.trim(u[0]));var u=`<div class="zsl-detail" style="${l}"><object class="nmhj-object"><div class="nmhj-inject" nmh-id="${c}"></div></object></div>`;zslQ("body").append(u),zslRender(zslQ(".zsl-detail").find(`.nmhj-inject[nmh-id="${c}"]`).get(0),{template:"loading"}),new Promise(e=>{f[c]?e(f[c]):console.log(Object.values([{id:c,sale:m}])),
ajax({
url:"temu/getProduct",
method:"post",
data:{
id:c,
sale:m,
aaa: Object.values( [{id:c,sale:m}] ),
ids:zsl.pakoEncode(Object.values([{id:c,sale:m}])),
referer:location.href,site:h.site
},
responseType:"json"
}
)
.then(t=>{f[c]=t,e(t)})}).then(t=>{0==zslQ(`.nmhj-inject[nmh-id="${c}"]`).length&&(referenceDom.before(appendHtml),zslRender(`.nmhj-inject[nmh-id="${c}"]`,{template:"loading"})),0==t.code?(t=g(t=zsl.parseApiData(t.data)),zsl.isEmpty(t)||zsl.each(t,function(t,e){e.data.unshift({dt_text:"智能找货",dd_text:"寻找低价货源",dd_click:p}),zslRender('.nmhj-inject[nmh-id="'+t+'"]',{template:"temu",options:{getData:{state:!0,data:e.data},isList:!1,rawData:e.rawData,idtheimg:p}})})):zslRender('.nmhj-inject[nmh-id="'+c+'"]',{template:"msgText",options:{text:"暂时没有相关数据,我们会抓紧收录(销量过低除外)"}})}).catch(t=>{zslRender('.nmhj-inject[nmh-id="'+c+'"]',{template:"msgText",options:{text:"未知错误,请刷新重试"}}),console.log(t)})}(),setTimeout(o,5e3)}const f={};navBall([{title:"采集数据",link:null,click:async()=>(efb.message.closeAll(),zsl.isEmpty(crxConfig.userResult)||zsl.isEmpty(crxConfig.userResult.userinfo)?(efb.message.error("您还未登录,请登录后再试"),await zsl.sleep(1500),navBall.login(),!1):/temu\.com\/.+?-g-\d+\.html/.test(location.href)||/temu\.com\/.*goods.html/.test(location.href)||/temu\.com\/.*goods.*.html/.test(location.href)?(efb.message({message:"数据采集中...",duration:0,showClose:!0}),void async function(){let e,a={};if(/-g-(\d+)\.html/.test(location.pathname))e=RegExp.$1;else{let t=new URLSearchParams(location.search);if(!t.get("goods_id"))return Promise.reject("请打开产品详情再进行采集");e=t.get("goods_id")}if("object"==typeof rawData){if(!(a=temuConfig.parseTemu(e,rawData,"page")))return Promise.reject("采集失败了")}else if(temuPickData.xhr.hasOwnProperty(e))a=temuConfig.parseTemu(e,temuPickData.xhr[e],"api");else{let t=await temuConfig.pickDetailDataByApi();if(t.hasOwnProperty("error_code")&&t.hasOwnProperty("error_msg"))return Promise.reject("采集失败,请刷新重试 - 10001");temuPickData.xhr[e]=t,a=temuConfig.parseTemu(e,t,"api")}let t={};if(void 0!==a.data.bannerList&&Array.isArray(a.data.bannerList))for(var o of a.data.bannerList)t[o]=1;if(void 0!==a.data.productDetail&&Array.isArray(a.data.productDetail))for(var s of a.data.productDetail)t[s]=1;if(void 0!==a.data.sku&&Array.isArray(a.data.sku))for(var n of a.data.sku)t[n.img]=1;for(var i of Object.keys(t))loadImg(i),sendMsg({action:"proxyDownload",content:i});return a.saveResult.then(async t=>(await zsl.sleep(3e3),t)).catch(t=>(console.log(t),Promise.reject("网络异常")))}().then(t=>{let e=t.data;efb.message.closeAll(),efb.messageBox.confirm("采集成功,是否前往TEMU后台创建商品","操作提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"success"}).then(()=>{{var s={id:e};let a=temuConfig.sellerOrigin+"/goods/product-create/category",o=window.open(a);subpageMessage(e=>{if(e.source===o){console.log("通知temu上架");let t=e.data.action;return(t=t.split("_"))[0]===crxConfig.crxId&&"subpageReady"==t[1]&&o.postMessage({action:crxConfig.crxId+"_autoProductCreate",data:s},a),!1}})}}).catch(()=>{})}).catch(t=>{console.log("采集失败",t)})):(efb.message.error("请前往产品详情页,再执行采集"),!1))},{title:"清除缓存",link:null,click:()=>zsl.versionCompare(crxConfig.version,"0.0.6")<0?efb.messageBox.confirm("清除缓存功能需插件版本0.0.6及以上,是否前往网盘(访问密码:1234)下载最新插件?","操作提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"success"}).then(()=>{window.open("https://slog.lanzouo.com/b058o4kuh").alert("密码 1234")}).catch(t=>{}):efb.messageBox.confirm("确定要清除当前站点的缓存吗?","操作提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"success"}).then(()=>{sendMsg({action:"clearSiteCache",content:{}}).then(t=>{location.reload()}).catch(t=>{efb.message.error("缓存清除失败,请刷新重试")})}).catch(t=>{})}]),renderNotice();const i=location.pathname.split("/");zsl.isEmpty(i)||(location.pathname.includes("/goods.htm")||i.includes("goods.html")||/-g-([\d]+)\.html/.test(location.pathname)?s():(i[1].includes("search_result.htm"),a()))});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。