epool86 / calculateshopee Goto Github PK
View Code? Open in Web Editor NEWThis is simple javascript to calculate your total lifetime spent/purchase and total number of order on Shopee.
This is simple javascript to calculate your total lifetime spent/purchase and total number of order on Shopee.
POST https://c-api-bit.shopeemobile.com/v4/tr/my net::ERR_BLOCKED_BY_CLIENT
N
@ [email protected]:1
(anonymous) @ [email protected]:1
e @ [email protected]:1
(anonymous) @ [email protected]:1
Promise.then (async)
(anonymous) @ [email protected]:1
Promise.catch (async)
e @ [email protected]:1
(anonymous) @ [email protected]:1
Promise.then (async)
(anonymous) @ [email protected]:1
Promise.catch (async)
e @ [email protected]:1
(anonymous) @ [email protected]:1
Promise.then (async)
(anonymous) @ [email protected]:1
Promise.catch (async)
e @ [email protected]:1
(anonymous) @ [email protected]:1
Promise.then (async)
(anonymous) @ [email protected]:1
Promise.catch (async)
e @ [email protected]:1
(anonymous) @ [email protected]:1
var total = 0;
var order = 0;
function calculate(next){
var opts = {
method: 'GET',
headers: {}
};
fetch('https://shopee.com.my/api/v4/order/get_order_list?limit=5&list_type=3&offset='+next, opts).then(function (response) {
return response.json();
})
.then(function (body) {
var next_offset = body.data.next_offset;
if(next_offset >= 0){
for (let [key, value] of Object.entries(body.data.details_list)) {
var total_temp = value.info_card.final_total / 100000;
total += total_temp;
order++;
console.log(order + ":", "RM " + total_temp + " - ", value.info_card.order_list_cards[0].items[0].name);
}
calculate(next_offset);
} else {
console.log('Calculation completed!');
console.log('GRAND TOTAL: RM ' + Math.round(total * 100) / 100);
}
});
}
calculate(0);
There's an error when i tried to run this code, the message was like this:
Access to fetch at 'https://shopee.com.my/api/v4/order/get_order_list?limit=5&list_type=3&offset=0' from origin 'https://shopee.co.id' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
7008.6b2a9aafa20b6b03.js:1
GET https://shopee.com.my/api/v4/order/get_order_list?limit=5&list_type=3&offset=0 net::ERR_FAILED 200 (OK)
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
f @ 7008.6b2a9aafa20b6b03.js:1
o.value @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
asyncGeneratorStep @ 7008.6b2a9aafa20b6b03.js:1
a @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ bundle.4c11e60a44e085c4.js:1
window.fetch @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ sap-hook-latest.1b34c2a293a7bd0f.js:1
(anonymous) @ sap-hook-latest.1b34c2a293a7bd0f.js:1
calculate @ VM2179:9
(anonymous) @ VM2224:1
shopee.co.id/:1 Access to fetch at 'https://shopee.com.my/api/v4/order/get_order_list?limit=5&list_type=3&offset=0' from origin 'https://shopee.co.id' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
7008.6b2a9aafa20b6b03.js:1
GET https://shopee.com.my/api/v4/order/get_order_list?limit=5&list_type=3&offset=0 net::ERR_FAILED 200 (OK)
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
f @ 7008.6b2a9aafa20b6b03.js:1
o.value @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
asyncGeneratorStep @ 7008.6b2a9aafa20b6b03.js:1
s @ 7008.6b2a9aafa20b6b03.js:1
Promise.then (async)
asyncGeneratorStep @ 7008.6b2a9aafa20b6b03.js:1
a @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ bundle.4c11e60a44e085c4.js:1
window.fetch @ 7008.6b2a9aafa20b6b03.js:1
(anonymous) @ sap-hook-latest.1b34c2a293a7bd0f.js:1
(anonymous) @ sap-hook-latest.1b34c2a293a7bd0f.js:1
calculate @ VM2179:9
(anonymous) @ VM2224:1
7008.6b2a9aafa20b6b03.js:1
Uncaught (in promise) TypeError: Failed to fetch
at 7008.6b2a9aafa20b6b03.js:1:881040
at f (7008.6b2a9aafa20b6b03.js:1:821312)
at o.value (7008.6b2a9aafa20b6b03.js:1:821079)
at Generator.throw (7008.6b2a9aafa20b6b03.js:1:821759)
at asyncGeneratorStep (7008.6b2a9aafa20b6b03.js:1:826827)
at s (7008.6b2a9aafa20b6b03.js:1:827099)
Salam bang,
kalau macam attribute2 quantity, product category, order date ada ke bang?
Apa lagi attribute yg available utk di explore?
Tq for the fruitful code sharing :D
Hello sir, sangat membantu. Boleh ke nak request untuk lazada?
Putting here the document for future enhancement: https://open.shopee.com/documents?version=2&module=87&type=2&id=58
Hi, would like to understand if there a way to add dates? I'm trying to organize the spending based on years and months and dates will be so helpful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.