MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / run

Function run

scripts/shopee_topVariation.js:78–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 showResult(b);
77 }
78 async function run() {
79 var url =
80 "https://shopee.vn/api/v2/item/get_ratings?filter=0&flag=1&itemid=" +
81 itemId +
82 "&limit=50&offset=" +
83 offset +
84 "&shopid=" +
85 shopId +
86 "&type=0";
87
88 setLoadingText(title + "<br/><br/>Đang quét trang " + page + "...");
89 let res = await fetch(url, {
90 headers: {
91 "x-api-source": "pc",
92 "x-requested-with": "XMLHttpRequest",
93 "x-shopee-language": "vi",
94 },
95 method: "GET",
96 mode: "cors",
97 credentials: "include",
98 });
99 let json = await res.json();
100 console.log(json);
101
102 json.error || !json.data || !json.data.ratings?.length
103 ? 1 < page && d()
104 : (a(json.data.ratings),
105 50 > page ? ((offset += 50), page++, await run()) : d());
106 }
107 function showResult(data) {
108 let html = Object.entries(data)
109 .map(([key, value], index) => {

Callers 1

Calls 2

dFunction · 0.70
aFunction · 0.70

Tested by

no test coverage detected