妈蛋,总算搞定了,明天刘老板自己搞

This commit is contained in:
2024-04-25 01:40:31 +08:00
parent c3ef37e184
commit 98fa8fc150
5 changed files with 7155 additions and 7209 deletions

View File

@@ -13,6 +13,7 @@
"crypto-js": "^4.0.0",
"dayjs": "^1.11.9",
"element-ui": "^2.15.13",
"query-string": "^9.0.0",
"spark-md5": "^3.0.2",
"v-viewer": "^1.6.4",
"vue": "^2.6.14",

View File

@@ -3,13 +3,13 @@
* @param token 从cookie中获取,判断从[_m_h5_c,_m_h5_tk]中取值,优先判断第一个
* @param appKey 取值window.mtopConfig
* @param formData formData中的data
* @param t 时间戳
* @returns {*}
*/
export const getSign = (token, appKey, formData) => {
console.log("获取到的token:%s", token)
export const getSign = (token, appKey, formData, t = (new Date()).getTime()) => {
token = token?.split("_")[0]
const t = (new Date()).getTime();
console.log("获取sign的参数:", token, appKey, formData, t)
return {
t, sign: function (e) {
function t(e, t) {

View File

@@ -3,6 +3,7 @@
**/
import {getSign} from "@/api/aliExpress";
import qs from "query-string"
/**
* 根据图片URL获取Blob对象
@@ -127,16 +128,14 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
new Promise(async (resolve) => {
let headers = {};
headers['Content-Type'] = 'text/html';
headers.cookie = await getAliexpressCookie(request.url);
const {_m_h5_c, _m_h5_tk} = cookie2Obj(headers.cookie)
const {appKey, formData} = request
const cookie = await getAliexpressCookie(request.url);
const {_m_h5_c, _m_h5_tk} = cookie2Obj(cookie)
const {query: {data, appKey}} = qs.parseUrl(request.url)
const {formData = data} = request
const {sign, t} = getSign(_m_h5_c || _m_h5_tk, appKey, formData)
const url = new URL(request.url)
let params = new URLSearchParams(url.search);
params.append('t', t)
params.append('sign', sign)
url.search = params.toString()
Promise.resolve().then(() => fetch(url.toString(), {
const url = qs.stringifyUrl({url: request.url, query: {sign, t}})
headers.cookie = await getAliexpressCookie(url);
Promise.resolve().then(() => fetch(url, {
'headers': headers, 'method': 'POST', 'referrerPolicy': 'no-referrer', 'credentials': 'include', 'mode': 'cors'
})).then((res) => {
// 创建了一个数据读取器

View File

@@ -286,13 +286,7 @@ export default {
getAliexpressGoodsList() {
sendAliexpressAPIMessage({
type: "aliexpress",
url: "https://seller-acs.aliexpress.com/h5/mtop.global.merchant.self.product.manager.render.list/1.0/?jsv=2.7.2&appKey=30267743&v=1.0&timeout=15000&H5Request=true&url=mtop.global.merchant.self.product.manager.render.list&__channel-id__=701301&api=mtop.global.merchant.self.product.manager.render.list&type=originaljson&dataType=json&valueType=original&x-i18n-regionID=AE&data=%7B%22channelId%22%3A%22701301%22%2C%22jsonBody%22%3A%22%7B%5C%22tab%5C%22%3A%5C%22online_product%5C%22%2C%5C%22sort%5C%22%3A%7B%7D%2C%5C%22filter%5C%22%3A%7B%5C%22queryCategory%5C%22%3Anull%2C%5C%22lowerPrice%5C%22%3Anull%2C%5C%22upperPrice%5C%22%3Anull%2C%5C%22status%5C%22%3A%5C%220%5C%22%2C%5C%22productId%5C%22%3Anull%7D%2C%5C%22pagination%5C%22%3A%7B%5C%22pageSize%5C%22%3A10%2C%5C%22current%5C%22%3A2%7D%7D%22%2C%22from%22%3A%22SELF%22%2C%22bizParam%22%3A%22%7B%5C%22version%5C%22%3A%5C%22simple%5C%22%7D%22%7D",
formData: JSON.stringify({
"channelId": "701301",
"jsonBody": "{\"tab\":\"online_product\",\"sort\":{},\"filter\":{\"queryCategory\":null,\"lowerPrice\":null,\"upperPrice\":null,\"status\":\"0\",\"productId\":null},\"pagination\":{\"pageSize\":10,\"current\":2}}",
"from": "SELF",
"bizParam": "{\"version\":\"simple\"}"
})
url: "https://seller-acs.aliexpress.com/h5/mtop.global.merchant.self.product.manager.render.list/1.0/?jsv=2.7.2&appKey=30267743&t=1713978403051&sign=ba2bda69b4a2695c7279d4bc05f51741&v=1.0&timeout=15000&H5Request=true&url=mtop.global.merchant.self.product.manager.render.list&__channel-id__=701301&api=mtop.global.merchant.self.product.manager.render.list&type=originaljson&dataType=json&valueType=original&x-i18n-regionID=AE&data=%7B%22channelId%22%3A%22701301%22%2C%22jsonBody%22%3A%22%7B%5C%22tab%5C%22%3A%5C%22online_product%5C%22%2C%5C%22sort%5C%22%3A%7B%7D%2C%5C%22filter%5C%22%3A%7B%5C%22queryCategory%5C%22%3Anull%2C%5C%22lowerPrice%5C%22%3Anull%2C%5C%22upperPrice%5C%22%3Anull%2C%5C%22status%5C%22%3A%5C%220%5C%22%2C%5C%22productId%5C%22%3Anull%7D%2C%5C%22pagination%5C%22%3A%7B%5C%22pageSize%5C%22%3A10%2C%5C%22current%5C%22%3A3%7D%7D%22%2C%22from%22%3A%22SELF%22%2C%22bizParam%22%3A%22%7B%5C%22version%5C%22%3A%5C%22simple%5C%22%7D%22%7D",
}).then(res => {
console.log(res)
})

14332
yarn.lock

File diff suppressed because it is too large Load Diff