Skip to content

Instantly share code, notes, and snippets.

@naixx
Last active July 19, 2025 19:00
Show Gist options
  • Select an option

  • Save naixx/9929f308bfc0aac649d7c48c4a510737 to your computer and use it in GitHub Desktop.

Select an option

Save naixx/9929f308bfc0aac649d7c48c4a510737 to your computer and use it in GitHub Desktop.

Revisions

  1. naixx revised this gist Jun 28, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Export aliexpress orders to clipboard as csv
    Original file line number Diff line number Diff line change
    @@ -56,6 +56,7 @@ $(".order-item-wraper").each((ind, el)=>{
    method: "GET",
    url: "https://ilogisticsaddress.aliexpress.com/ajax_logistics_track.htm?orderId=" + order.id + "&callback=test",
    onload:(data)=>{
    console.log(eval(data.responseText));
    order.tracking = eval(data.responseText).tracking;
    order.trackingNumber = order.tracking.map(it=>it.mailNo).join(", ");
    resolve(order);
  2. naixx revised this gist Jun 28, 2021. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions Export aliexpress orders to clipboard as csv
    Original file line number Diff line number Diff line change
    @@ -95,12 +95,15 @@ $('<button/>', {
    $("#csvBtn").text("Loading...");

    Promise.all(reqs).then(o =>{
    var s = "";// = "id\t trackingNumber\t productsNames\t status\t orderPrice \t productsPrice \t url \n";
    var s = "";// = "date\t trackingNumber\t productsNames\t status\t orderPrice \t productsPrice \t url \n";
    var preview = "<table>";
    orders.sort((a, b)=> b.date - a.date).forEach(e=> {
    console.log(e);

    s += e.id + "\t";
    var d = new Date(e.date);
    var date = d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate();

    s += date + "\t";
    s += (e.trackingNumber || ' ') + "\t";
    s += e.productsNames + "\t";
    s += e.status + "\t";
    @@ -111,7 +114,7 @@ $('<button/>', {
    s += "\n";

    preview += "<tr>";
    preview += "<td>" + e.id + "</td>";
    preview += "<td>" + date + "</td>";
    preview += "<td>" +(e.trackingNumber || ' ') + "</td>";
    preview += "<td style='width: 25%'>" +e.productsNames + "</td>";
    preview += "<td>" + e.status + "</td>";
    @@ -138,8 +141,8 @@ $('<button/>', {
    text: "Show/hide preview",
    id: 'togglePreview',
    click: function () {
    $("#preview").toggle();
    }}).appendTo("#appeal-alert");
    $("#preview").toggle();
    }}).appendTo("#appeal-alert");


    function test(data){ return data;}
  3. naixx revised this gist Jun 28, 2021. 1 changed file with 32 additions and 3 deletions.
    35 changes: 32 additions & 3 deletions Export aliexpress orders to clipboard as csv
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,10 @@
    // @version 0.1
    // @description try to take over the world!
    // @author You
    // @match https://trade.aliexpress.ru/orderList.htm*
    // @match https://trade.aliexpress.com/orderList.htm*
    // @match https://trade.aliexpress.ru/order_list.htm*
    // @match https://trade.aliexpress.com/order_list.htm*
    // @grant unsafeWindow
    // @grant GM_xmlhttpRequest
    // @grant GM_setClipboard
    @@ -38,6 +41,7 @@ $(".order-item-wraper").each((ind, el)=>{
    var hasTracking = $(el).find(".button-logisticsTracking ").length > 0;
    let order = {
    id: $(el).find(".order-info .first-row .info-body ").text().trim(),
    date: Date.parse($(el).find(".order-info .second-row .info-body ").text().trim()),
    status: $(el).find(".order-status .f-left").text().trim(),
    orderPrice: $(el).find(".amount-num").text().trim(),
    productsPrice: products.map((it)=> it.price).reduce((a, b) => a + b, 0),
    @@ -80,38 +84,63 @@ $('#mybutton').one('click', function(){
    id: "field",
    value: 'LOAD CSV'
    });
    $("body").append(r);
    $("body").append(r);
    });


    $('<button/>', {
    text: "LOAD", //set text 1 to 10
    id: 'csvBtn',
    click: function () {
    $("#csvBtn").text("Loading...");

    Promise.all(reqs).then(o =>{
    var s = "";// = "id\t trackingNumber\t productsNames\t status\t orderPrice \t productsPrice \t url \n";
    orders.forEach(e=> {
    var preview = "<table>";
    orders.sort((a, b)=> b.date - a.date).forEach(e=> {
    console.log(e);

    s += e.id + "\t";
    s += (e.trackingNumber || ' ') + "\t";
    s += e.productsNames + "\t";
    s += e.status + "\t";
    s += e.orderPrice + "\t";
    s += e.productsPrice + "\t";
    s += "https://trade.aliexpress.com/order_detail.htm?orderId=" + e.id;

    s += "\n";

    preview += "<tr>";
    preview += "<td>" + e.id + "</td>";
    preview += "<td>" +(e.trackingNumber || ' ') + "</td>";
    preview += "<td style='width: 25%'>" +e.productsNames + "</td>";
    preview += "<td>" + e.status + "</td>";
    preview += "<td>" +e.orderPrice + "</td>";
    preview += "<td>" + e.productsPrice + "</td>";
    var url = "https://trade.aliexpress.com/order_detail.htm?orderId=" + e.id;
    preview += "<td><a href='" + url + "'>" + url + "</a></td>";
    preview += "</tr>";

    });
    preview += "</table>";
    console.log(s);
    GM_setClipboard (s);
    $("#csvBtn").text("Loaded to clipboard");
    $("#preview").remove();
    $(preview).attr('id', 'preview').css({"overflow-x": "scroll"}).appendTo("#appeal-alert");
    });


    }
    }).appendTo("#appeal-alert");

    $('<button/>', {
    text: "Show/hide preview",
    id: 'togglePreview',
    click: function () {
    $("#preview").toggle();
    }}).appendTo("#appeal-alert");


    function test(data){ return data;}

  4. naixx created this gist Sep 7, 2017.
    117 changes: 117 additions & 0 deletions Export aliexpress orders to clipboard as csv
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,117 @@
    // ==UserScript==
    // @name Aliexpress
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description try to take over the world!
    // @author You
    // @match https://trade.aliexpress.com/orderList.htm*
    // @grant unsafeWindow
    // @grant GM_xmlhttpRequest
    // @grant GM_setClipboard
    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
    // ==/UserScript==

    (function() {
    'use strict';


    })();

    var orders = [];
    var reqs = [];
    $(".order-item-wraper").each((ind, el)=>{
    var products = [];

    $(el).find(".order-body").each((i,e)=>{
    $(e).find(".product-sets").each((i,e)=>{
    let obj = {
    title: $(e).find(".product-title").text().trim(),
    price: parseFloat($(e).find(".product-amount span:first()").text().trim().slice(1).trim()),
    amount: $(e).find(".product-amount span:eq(1)").text().trim().slice(1)
    };
    products.push(obj);
    // console.log(obj);
    });
    // console.log(products);
    });

    var hasTracking = $(el).find(".button-logisticsTracking ").length > 0;
    let order = {
    id: $(el).find(".order-info .first-row .info-body ").text().trim(),
    status: $(el).find(".order-status .f-left").text().trim(),
    orderPrice: $(el).find(".amount-num").text().trim(),
    productsPrice: products.map((it)=> it.price).reduce((a, b) => a + b, 0),
    productsNames: products.map((it)=> it.title).join(", "),

    hasTracking: hasTracking,
    products: products,
    };
    if (hasTracking){
    var req = new Promise((resolve, reject) => {
    GM_xmlhttpRequest({
    method: "GET",
    url: "https://ilogisticsaddress.aliexpress.com/ajax_logistics_track.htm?orderId=" + order.id + "&callback=test",
    onload:(data)=>{
    order.tracking = eval(data.responseText).tracking;
    order.trackingNumber = order.tracking.map(it=>it.mailNo).join(", ");
    resolve(order);
    orders.push(order);
    },
    onerror: () => reject(400)
    });
    });
    reqs.push(req);
    } else{
    orders.push(order);
    }
    });


    $.when.apply(null, reqs).done(function(){
    // console.log(orders);
    // console.log(orders.length);
    });
    //<button id="search-btn" class="ui-button ui-button-primary search-btn" type="button">Search</button>


    $('#mybutton').one('click', function(){
    var r=$('<input/>').attr({
    type: "button",
    id: "field",
    value: 'LOAD CSV'
    });
    $("body").append(r);
    });
    $('<button/>', {
    text: "LOAD", //set text 1 to 10
    id: 'csvBtn',
    click: function () {
    $("#csvBtn").text("Loading...");
    Promise.all(reqs).then(o =>{
    var s = "";// = "id\t trackingNumber\t productsNames\t status\t orderPrice \t productsPrice \t url \n";
    orders.forEach(e=> {
    console.log(e);
    s += e.id + "\t";
    s += (e.trackingNumber || ' ') + "\t";
    s += e.productsNames + "\t";
    s += e.status + "\t";
    s += e.orderPrice + "\t";
    s += e.productsPrice + "\t";
    s += "https://trade.aliexpress.com/order_detail.htm?orderId=" + e.id;

    s += "\n";


    });
    console.log(s);
    GM_setClipboard (s);
    $("#csvBtn").text("Loaded to clipboard");
    });


    }
    }).appendTo("#appeal-alert");


    function test(data){ return data;}