AndShy / Ali-Total-Price

userscript for showing Aliexpress Total Price
GNU General Public License v3.0
26 stars 4 forks source link

Different page #17

Closed dragoncity17 closed 1 year ago

dragoncity17 commented 1 year ago

Do you know how have the original page, or use your script with this page ?

Example : https://fr.aliexpress.com/item/1005001777223090.html

Capture d'écran 2023-07-24 151520

Thanks for your help ! :)

AndShy commented 1 year ago

cookie xman_us_f try to delete x_as_i key with value for new interface value of that key should be encoded of
{"channel":"AFFILIATE","tagtime":1900000000000} : %7B%22channel%22%3A%22AFFILIATE%22%2C%22tagtime%22%3A1900000000000%7D number should be greater than 1800000000000

dragoncity17 commented 1 year ago

Thanks for your answer ! :)

I tested but same... I blocked all cookies same ^^

image

AndShy commented 1 year ago

ok. my bad. you should add key with value, instead of delete it. &x_as_i=%7B%22channel%22%3A%22AFFILIATE%22%2C%22tagtime%22%3A1900000000000%7D& I'm using "editthiscookie" extension for this

dragoncity17 commented 1 year ago

I use this extension too ! :) But ... I don't understand exactly what I need to do... sorry... o_O

I tested to add ... and delete... but I think it's not like that.

If you have an "mini" tutorial ... thanks in advance.

AndShy commented 1 year ago

2023-07-24 162528 2023-07-24 162645

dragoncity17 commented 1 year ago

Ha ha... it's exactly I did ! I add what you say and validate... but nothing ^^

image

dragoncity17 commented 1 year ago

I try with userscript do you think it's possible ?

Not correct again ...but the idea :

// ==UserScript==
// @name         Modifier le cookie AliExpress
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Modifier le cookie xman_us_f sur AliExpress
// @author       Vous
// @match        *://*.aliexpress.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Nouvelle partie à ajouter au cookie xman_us_f
    var newCookiePart = "&x_as_i=%7B%22channel%22%3A%22AFFILIATE%22%2C%22tagtime%22%3A1900000000000%7D&";

    // Récupérer la valeur du cookie actuel
    var cookies = document.cookie.split(';');
    var updatedCookie = '';
    var cookieName = 'xman_us_f';

    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i].trim();
        if (cookie.indexOf(cookieName + '=') === 0) {
            // Mettre à jour le cookie avec la nouvelle valeur
            updatedCookie = cookieName + '=' + encodeURIComponent(cookie.substring(cookieName.length + 1) + newCookiePart);
            break;
        }
    }

    // Définir le cookie mis à jour
    document.cookie = updatedCookie;
})();
AndShy commented 1 year ago

If it doesn't work with simple cookies change then script doesn't change anything For me changing cookies working till cookies exist

dragoncity17 commented 1 year ago

You are certainly right... You add in the end and validate... That's all? Do you refresh the page? Maybe because it's in french...I don't like to don't find the problem 😅

AndShy commented 1 year ago

Yes. And refresh. Also you can try another browser and hard page refresh PS: as I can see there is difference in layout based on your IP. Or based on country of account (which is you unable to change)

dragoncity17 commented 1 year ago

I found the problem I added an "&" at the end.... !

So this script work : https://gist.github.com/dragoncity17/db748a6a68537c2eb5206b113d649f83

// ==UserScript==
// @name         AliExpress Modification cookie xman_us_f
// @description  Modifier le cookie xman_us_f sur AliExpress
// @match        *://*.aliexpress.com/*
// ==/UserScript==

// Thanks AndShy for your help ! :)

(function() {
    'use strict';

    // Nouvelle valeur du cookie xman_us_f à ajouter
    var newValueToAdd = "&x_as_i=%7B%22channel%22%3A%22AFFILIATE%22%2C%22tagtime%22%3A1900000000000%7D";

    // Vérifier si le cookie existe déjà
    var currentCookie = document.cookie;
    var cookieName = "xman_us_f=";
    var cookieStartIndex = currentCookie.indexOf(cookieName);

    if (cookieStartIndex === -1) {
        // Si le cookie n'existe pas, ajouter la nouvelle valeur complète
        document.cookie = "xman_us_f=" + newValueToAdd;
    } else {
        // Si le cookie existe, ajouter la nouvelle valeur à la fin sans remplacer l'ancienne valeur
        var cookieEndIndex = currentCookie.indexOf(";", cookieStartIndex);
        var cookieValue = "";

        if (cookieEndIndex === -1) {
            cookieValue = currentCookie.substring(cookieStartIndex + cookieName.length);
        } else {
            cookieValue = currentCookie.substring(cookieStartIndex + cookieName.length, cookieEndIndex);
        }

        // Mettre à jour le cookie en ajoutant la nouvelle valeur à la fin
        document.cookie = "xman_us_f=" + cookieValue + newValueToAdd;
    }
})();
AndShy commented 1 year ago

Strange. Because I'm also add separator at the end of cookies and this works fine. Maybe extension fix it

AndShy commented 1 year ago

In script you should check for x_as_i presence instead of xman_us_f, which should always presence. Otherwise, when inserting key, after = should not be &

dragoncity17 commented 1 year ago

I checked it's ok, it always add "&x_as_i=%7B%22channel%22%3A%22AFFILIATE%22%2C%22tagtime%22%3A1900000000000%7D" at the end of cookies (and just 1 time), I tested again this morning perfect ! :)

You can test need delete all cookies "aliexpress". And add this script, and check cookie with "EditThisCookie"

dragoncity17 commented 1 year ago

A little update for check cookie before add : https://gist.github.com/dragoncity17/db748a6a68537c2eb5206b113d649f83

Yassin-Amin commented 1 year ago

2023-07-24 162528 2023-07-24 162645

when I try doing this nothing happens (tried it with the script in tampermonkey and with editthiscookie) image image

AndShy commented 1 year ago

@Yassin-Amin you can try another browser with all cookies clearing. In this manner I'm find another layout version and cookies for that. Also you can play with number, because original was something like 174.....5 and 1800.....0 work fine for me, but lower or much greater - not. Also you can try @dragoncity17 's script for auto changing cookies

Yassin-Amin commented 1 year ago

@Yassin-Amin you can try another browser with all cookies clearing. In this manner I'm find another layout version and cookies for that. Also you can play with number, because original was something like 174.....5 and 1800.....0 work fine for me, but lower or much greater - not. Also you can try @dragoncity17 's script for auto changing cookies

can you show me what number to use like a tutorial or something. I have also tried using the script but nothing changes

AndShy commented 1 year ago

@Yassin-Amin looks like cookies not working anymore. Yesterday I see new Ali design in browser with old cookies

Yassin-Amin commented 1 year ago

@Yassin-Amin looks like cookies not working anymore. Yesterday I see new Ali design in browser with old cookies

so there is no fix? i just want to be able to see the countries of the reviewers image image

dragoncity17 commented 1 year ago

Yes doesn't work now ! :-(

Hum... @AndShy do you have an new value ?

Previously :

var newValueToAdd = "&x_as_i=%7B%22channel%22%3A%22AFFILIATE%22%2C%22tagtime%22%3A1900000000000%7D";

AndShy commented 1 year ago
tgtime = Math.floor(Math.random() * 10000000000000 + 1000000000000)
newValueToAdd = '&x_as_i=' + encodeURIComponent('{"channel":"AFFILIATE","tagtime":' + tgtime + '}')
AndShy commented 1 year ago

But I think Ali permanently changed layout for everyone

dragoncity17 commented 1 year ago

I modified but nothing change.... hum... :-/

var tgtime = Math.floor(Math.random() * 9999999999999) + 1000000000000;
var newValueToAdd = '&x_as_i=' + encodeURIComponent('{"channel":"AFFILIATE","tagtime":' + tgtime + '}');

Yes maybe all have new design...arf...

AndShy commented 1 year ago

But you can try refreshing page with random value. Maybe you're lucky😁

Yassin-Amin commented 1 year ago

But you can try refreshing page with random value. Maybe you're lucky😁

@dragoncity17 @AndShy just hope one of you finds a fix 😁 😁

dragoncity17 commented 1 year ago

No lucky for the moment ^^

Hum... @AndShy can you try to convert your script to new interface ?

It will be great... ! :)

AndShy commented 1 year ago

I can, but I don't want to, because at this moment I rarely use AliExpress. As I can see atm you should only change part with HTML code and change half of CSS selectors

dragoncity17 commented 1 year ago

Ok I past time... but normally all is ok, you can update your code with my code no problem ;)

https://gist.github.com/dragoncity17/f3a96f1af7fd94cf9aa4f57db08a3650