mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-09-05 15:22:44 +08:00
Compare commits
No commits in common. "3974a33844215d19d1c9418e155eb4142f757409" and "7c8dc4f8473c9a75201958e04a47456c2005dd26" have entirely different histories.
3974a33844
...
7c8dc4f847
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
jd_10dou.js
12
jd_10dou.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
15
jd_daycj.js
15
jd_daycj.js
File diff suppressed because one or more lines are too long
11
jd_dayf.js
11
jd_dayf.js
File diff suppressed because one or more lines are too long
14
jd_dayf2.js
14
jd_dayf2.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
19
jd_dplh0415.js
Normal file
19
jd_dplh0415.js
Normal file
File diff suppressed because one or more lines are too long
19
jd_dplh0425.js
Normal file
19
jd_dplh0425.js
Normal file
File diff suppressed because one or more lines are too long
19
jd_dplh0505.js
Normal file
19
jd_dplh0505.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16
jd_dwapp.js
16
jd_dwapp.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
16
jd_fruit_diyhelp.js
Normal file
16
jd_fruit_diyhelp.js
Normal file
File diff suppressed because one or more lines are too long
15
jd_fruit_friend.js
Normal file
15
jd_fruit_friend.js
Normal file
File diff suppressed because one or more lines are too long
14
jd_fruit_help.js
Normal file
14
jd_fruit_help.js
Normal file
File diff suppressed because one or more lines are too long
16
jd_fruit_task.js
Normal file
16
jd_fruit_task.js
Normal file
File diff suppressed because one or more lines are too long
16
jd_fruit_watering.js
Normal file
16
jd_fruit_watering.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
14
jd_jrsign.js
Normal file
14
jd_jrsign.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5
jd_kjsign.js
Normal file
5
jd_kjsign.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
24
jd_mkt_answer.js
Normal file
24
jd_mkt_answer.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
15
jd_opencard_0407.js
Normal file
15
jd_opencard_0407.js
Normal file
File diff suppressed because one or more lines are too long
14
jd_opencard_04071.js
Normal file
14
jd_opencard_04071.js
Normal file
File diff suppressed because one or more lines are too long
16
jd_opencard_0421.js
Normal file
16
jd_opencard_0421.js
Normal file
File diff suppressed because one or more lines are too long
14
jd_opencard_0423.js
Normal file
14
jd_opencard_0423.js
Normal file
File diff suppressed because one or more lines are too long
15
jd_opencard_0426.js
Normal file
15
jd_opencard_0426.js
Normal file
File diff suppressed because one or more lines are too long
16
jd_opencard_0428.js
Normal file
16
jd_opencard_0428.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
18
jd_tjfb.js
18
jd_tjfb.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
277
jd_try.js
277
jd_try.js
@ -115,7 +115,7 @@ let args_xh = {
|
|||||||
* C商品原价99元,试用价1元,如果下面设置为50,那么C商品将会被加入到待提交的试用组
|
* C商品原价99元,试用价1元,如果下面设置为50,那么C商品将会被加入到待提交的试用组
|
||||||
* 默认为0
|
* 默认为0
|
||||||
* */
|
* */
|
||||||
jdPrice: process.env.JD_TRY_PRICE * 1 || 10,
|
jdPrice: process.env.JD_TRY_PRICE * 1 || 20,
|
||||||
/*
|
/*
|
||||||
* 下面有一个function是可以获取tabId列表,名为try_tabList
|
* 下面有一个function是可以获取tabId列表,名为try_tabList
|
||||||
* 可设置环境变量:JD_TRY_TABID,用@进行分隔
|
* 可设置环境变量:JD_TRY_TABID,用@进行分隔
|
||||||
@ -138,7 +138,7 @@ let args_xh = {
|
|||||||
* C商品原价49元,现在试用价1元,如果下面设置为1,那C商品也会被添加到带提交试用组,因为1 = 1
|
* C商品原价49元,现在试用价1元,如果下面设置为1,那C商品也会被添加到带提交试用组,因为1 = 1
|
||||||
* 可设置环境变量:JD_TRY_TRIALPRICE,默认为0
|
* 可设置环境变量:JD_TRY_TRIALPRICE,默认为0
|
||||||
* */
|
* */
|
||||||
trialPrice: process.env.JD_TRY_TRIALPRICE * 1 || 0.01,
|
trialPrice: process.env.JD_TRY_TRIALPRICE * 1 || 0,
|
||||||
/*
|
/*
|
||||||
* 最小提供数量,例如试用商品只提供2份试用资格,当前设置为1,则会进行申请
|
* 最小提供数量,例如试用商品只提供2份试用资格,当前设置为1,则会进行申请
|
||||||
* 若只提供5分试用资格,当前设置为10,则不会申请
|
* 若只提供5分试用资格,当前设置为10,则不会申请
|
||||||
@ -275,7 +275,7 @@ let args_xh = {
|
|||||||
}
|
}
|
||||||
await try_apply(trialActivityTitleList[i], trialActivityIdList[i]);
|
await try_apply(trialActivityTitleList[i], trialActivityIdList[i]);
|
||||||
console.log(`间隔等待中,请等待15秒 \n`);
|
console.log(`间隔等待中,请等待15秒 \n`);
|
||||||
await $.wait(15000);
|
await $.wait(150000);
|
||||||
}
|
}
|
||||||
console.log('试用申请执行完毕...');
|
console.log('试用申请执行完毕...');
|
||||||
$.giveupNum = 0;
|
$.giveupNum = 0;
|
||||||
@ -592,161 +592,142 @@ async function initJsToken() {
|
|||||||
* 获取商品列表并且过滤
|
* 获取商品列表并且过滤
|
||||||
*/
|
*/
|
||||||
async function try_feedsList(tabId, page) {
|
async function try_feedsList(tabId, page) {
|
||||||
const sign = await h5stSign(
|
const sign = await h5stSign(
|
||||||
{
|
{
|
||||||
functionId: 'qryH5BabelFloors',
|
functionId: 'try_SpecFeedList',
|
||||||
appid: 'newtry',
|
appid: 'newtry',
|
||||||
body: {
|
body: {
|
||||||
activityId: '3C751WNneAUaZ8Lw8xYN7cbSE8gm',
|
tabId: String(tabId),
|
||||||
pageId: '5457569',
|
page: Number(page),
|
||||||
uuid: '',
|
version: 2,
|
||||||
queryFloorsParam: {
|
source: 'default',
|
||||||
floorParams: { 115571575: { tabId: tabId, page: page, source: 'lottery', sessionId: 'b5a86af7e7524b50b38e66d1c96cc244' } },
|
client: 'outer',
|
||||||
type: 2,
|
},
|
||||||
},
|
'x-api-eid-token': $.jsToken,
|
||||||
siteClient: 'apple',
|
},
|
||||||
siteClientVersion: '12.4.1',
|
'35fa0',
|
||||||
},
|
);
|
||||||
'x-api-eid-token': $.jsToken,
|
|
||||||
},
|
|
||||||
'35fa0'
|
|
||||||
)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await api({
|
const { data } = await api({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `http://api.m.jd.com/client.action`,
|
url: `http://api.m.jd.com/client.action`,
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
origin: 'https://prodev.m.jd.com',
|
origin: 'https://prodev.m.jd.com',
|
||||||
Referer: 'https://prodev.m.jd.com/mall/active/3C751WNneAUaZ8Lw8xYN7cbSE8gm/index.html',
|
Referer: 'https://prodev.m.jd.com/mall/active/3C751WNneAUaZ8Lw8xYN7cbSE8gm/index.html',
|
||||||
'User-Agent': $.userAgent,
|
'User-Agent': $.userAgent,
|
||||||
'x-referer-page': 'https://prodev.m.jd.com/mall/active/3C751WNneAUaZ8Lw8xYN7cbSE8gm/index.html',
|
'x-referer-page': 'https://prodev.m.jd.com/mall/active/3C751WNneAUaZ8Lw8xYN7cbSE8gm/index.html',
|
||||||
'x-rp-client': 'h5_1.0.0',
|
'x-rp-client': 'h5_1.0.0',
|
||||||
},
|
},
|
||||||
data: sign.qs,
|
data: sign.qs,
|
||||||
})
|
});
|
||||||
|
|
||||||
let tempKeyword = ``
|
let tempKeyword = ``;
|
||||||
// 兼容两种结构
|
if (data.code === '0') {
|
||||||
let feedList, hasNext;
|
console.log(`第 ${size++} 次获取试用商品成功,tabId:${args_xh.tabId[$.nowTabIdIndex]} 的 第 ${page} 页`);
|
||||||
if (data.data && data.data.feedList) {
|
console.log(`获取到商品 ${data.data.feedList.length} 条`);
|
||||||
feedList = data.data.feedList;
|
for (let item of data.data.feedList) {
|
||||||
hasNext = data.data.hasNext;
|
if (item.applyNum === null) {
|
||||||
} else if (
|
args_xh.printLog ? console.log(`商品未到申请时间:${item.skuTitle}\n`) : '';
|
||||||
data.floorResponse &&
|
continue;
|
||||||
data.floorResponse['115571575'] &&
|
|
||||||
data.floorResponse['115571575'].providerData &&
|
|
||||||
data.floorResponse['115571575'].providerData.data &&
|
|
||||||
data.floorResponse['115571575'].providerData.data.feedsComponent
|
|
||||||
) {
|
|
||||||
feedList = data.floorResponse['115571575'].providerData.data.feedsComponent.feedList;
|
|
||||||
hasNext = data.floorResponse['115571575'].providerData.data.feedsComponent.hasNext;
|
|
||||||
}
|
}
|
||||||
if (data.code === '0' && feedList) {
|
if (trialActivityIdList.length >= args_xh.maxLength) {
|
||||||
console.log(`第 ${size++} 次获取试用商品成功,tabId:${args_xh.tabId[$.nowTabIdIndex]} 的 第 ${page} 页`)
|
console.log('商品列表长度已满.结束获取');
|
||||||
console.log(`获取到商品 ${feedList.length} 条`)
|
break;
|
||||||
for (let item of feedList) {
|
}
|
||||||
if (item.applyNum === null) {
|
if (item.applyState === 1) {
|
||||||
args_xh.printLog ? console.log(`商品未到申请时间:${item.skuTitle}\n`) : ''
|
args_xh.printLog ? console.log(`商品已申请试用:${item.skuTitle}\n`) : '';
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
if (trialActivityIdList.length >= args_xh.maxLength) {
|
if (item.applyState !== null) {
|
||||||
console.log('商品列表长度已满.结束获取')
|
args_xh.printLog ? console.log(`商品状态异常,未找到skuTitle\n`) : '';
|
||||||
break
|
continue;
|
||||||
}
|
}
|
||||||
if (item.applyState === 1) {
|
if (args_xh.passZhongCao) {
|
||||||
args_xh.printLog ? console.log(`商品已申请试用:${item.skuTitle}\n`) : ''
|
$.isPush = true;
|
||||||
continue
|
if (item.tagList.length !== 0) {
|
||||||
}
|
for (let itemTag of item.tagList) {
|
||||||
if (item.applyState !== null) {
|
if (itemTag.tagType === 3) {
|
||||||
args_xh.printLog ? console.log(`商品状态异常,未找到skuTitle\n`) : ''
|
args_xh.printLog ? console.log('商品被过滤,该商品是种草官专属') : '';
|
||||||
continue
|
$.isPush = false;
|
||||||
}
|
break;
|
||||||
if (args_xh.passZhongCao) {
|
} else if (itemTag.tagType === 5) {
|
||||||
$.isPush = true
|
args_xh.printLog ? console.log('商品被跳过,该商品是付费试用!') : '';
|
||||||
if (item.tagList.length !== 0) {
|
$.isPush = false;
|
||||||
for (let itemTag of item.tagList) {
|
break;
|
||||||
if (itemTag.tagType === 3) {
|
}
|
||||||
args_xh.printLog ? console.log('商品被过滤,该商品是种草官专属') : ''
|
|
||||||
$.isPush = false
|
|
||||||
break
|
|
||||||
} else if (itemTag.tagType === 5) {
|
|
||||||
args_xh.printLog ? console.log('商品被跳过,该商品是付费试用!') : ''
|
|
||||||
$.isPush = false
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (item.skuTitle && $.isPush) {
|
|
||||||
args_xh.printLog ? console.log(`检测 tabId:${args_xh.tabId[$.nowTabIdIndex]} 的 第 ${page} 页 第 ${$.nowItem++ + 1} 个商品\n${item.skuTitle}`) : ''
|
|
||||||
if (args_xh.whiteList) {
|
|
||||||
if (args_xh.whiteListKeywords.some((fileter_word) => item.skuTitle.includes(fileter_word))) {
|
|
||||||
args_xh.printLog ? console.log(`商品白名单通过,将加入试用组,trialActivityId为${item.trialActivityId}\n`) : ''
|
|
||||||
trialActivityIdList.push(item.trialActivityId)
|
|
||||||
trialActivityTitleList.push(item.skuTitle)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tempKeyword = ``
|
|
||||||
if (parseFloat(item.jdPrice) <= args_xh.jdPrice) {
|
|
||||||
args_xh.printLog ? console.log(`商品被过滤,商品价格 ${item.jdPrice} < ${args_xh.jdPrice} \n`) : ''
|
|
||||||
} else if (parseFloat(item.supplyNum) < args_xh.minSupplyNum && item.supplyNum !== null) {
|
|
||||||
args_xh.printLog ? console.log(`商品被过滤,提供申请的份数小于预设申请的份数 \n`) : ''
|
|
||||||
} else if (parseFloat(item.applyNum) > args_xh.applyNumFilter && item.applyNum !== null) {
|
|
||||||
args_xh.printLog ? console.log(`商品被过滤,已申请人数大于预设的${args_xh.applyNumFilter}人 \n`) : ''
|
|
||||||
} else if (item.jdPrice === null) {
|
|
||||||
args_xh.printLog ? console.log(`商品被过滤,商品无价,不能申请 \n`) : ''
|
|
||||||
} else if (parseFloat(item.trialPrice) > args_xh.trialPrice) {
|
|
||||||
args_xh.printLog ? console.log(`商品被过滤,商品试用价大于预设试用价 \n`) : ''
|
|
||||||
} else if (args_xh.titleFilters.some((fileter_word) => (item.skuTitle.includes(fileter_word) ? (tempKeyword = fileter_word) : ''))) {
|
|
||||||
args_xh.printLog ? console.log(`商品被过滤,含有关键词 ${tempKeyword}\n`) : ''
|
|
||||||
} else {
|
|
||||||
args_xh.printLog ? console.log(`商品通过,加入试用组,trialActivityId为${item.trialActivityId}\n`) : ''
|
|
||||||
if (trialActivityIdList.indexOf(item.trialActivityId) === -1) {
|
|
||||||
trialActivityIdList.push(item.trialActivityId)
|
|
||||||
trialActivityTitleList.push(item.skuTitle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ($.isPush !== false) {
|
|
||||||
console.error('skuTitle解析异常')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
console.log(`当前试用组长度为:${trialActivityIdList.length}`)
|
}
|
||||||
console.log(`下一页状态:${hasNext}`)
|
}
|
||||||
if (hasNext === false) {
|
if (item.skuTitle && $.isPush) {
|
||||||
if ($.nowTabIdIndex < args_xh.tabId.length) {
|
args_xh.printLog ? console.log(`检测 tabId:${args_xh.tabId[$.nowTabIdIndex]} 的 第 ${page} 页 第 ${$.nowItem++ + 1} 个商品\n${item.skuTitle}`) : '';
|
||||||
$.nowTabIdIndex++
|
if (args_xh.whiteList) {
|
||||||
$.nowPage = 1
|
if (args_xh.whiteListKeywords.some((fileter_word) => item.skuTitle.includes(fileter_word))) {
|
||||||
$.nowItem = 1
|
args_xh.printLog ? console.log(`商品白名单通过,将加入试用组,trialActivityId为${item.trialActivityId}\n`) : '';
|
||||||
$.retrynum = 0
|
trialActivityIdList.push(item.trialActivityId);
|
||||||
} else {
|
trialActivityTitleList.push(item.skuTitle);
|
||||||
// 这下是真的没了
|
}
|
||||||
$.retrynum = 999
|
} else {
|
||||||
}
|
tempKeyword = ``;
|
||||||
|
if (parseFloat(item.jdPrice) <= args_xh.jdPrice) {
|
||||||
|
args_xh.printLog ? console.log(`商品被过滤,商品价格 ${item.jdPrice} < ${args_xh.jdPrice} \n`) : '';
|
||||||
|
} else if (parseFloat(item.supplyNum) < args_xh.minSupplyNum && item.supplyNum !== null) {
|
||||||
|
args_xh.printLog ? console.log(`商品被过滤,提供申请的份数小于预设申请的份数 \n`) : '';
|
||||||
|
} else if (parseFloat(item.applyNum) > args_xh.applyNumFilter && item.applyNum !== null) {
|
||||||
|
args_xh.printLog ? console.log(`商品被过滤,已申请人数大于预设的${args_xh.applyNumFilter}人 \n`) : '';
|
||||||
|
} else if (item.jdPrice === null) {
|
||||||
|
args_xh.printLog ? console.log(`商品被过滤,商品无价,不能申请 \n`) : '';
|
||||||
|
} else if (parseFloat(item.trialPrice) > args_xh.trialPrice) {
|
||||||
|
args_xh.printLog ? console.log(`商品被过滤,商品试用价大于预设试用价 \n`) : '';
|
||||||
|
} else if (args_xh.titleFilters.some((fileter_word) => (item.skuTitle.includes(fileter_word) ? (tempKeyword = fileter_word) : ''))) {
|
||||||
|
args_xh.printLog ? console.log(`商品被过滤,含有关键词 ${tempKeyword}\n`) : '';
|
||||||
} else {
|
} else {
|
||||||
$.nowPage++
|
args_xh.printLog ? console.log(`商品通过,加入试用组,trialActivityId为${item.trialActivityId}\n`) : '';
|
||||||
$.retrynum = 0
|
if (trialActivityIdList.indexOf(item.trialActivityId) === -1) {
|
||||||
|
trialActivityIdList.push(item.trialActivityId);
|
||||||
|
trialActivityTitleList.push(item.skuTitle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
console.log(`💩 获得试用列表失败: ${data.message}`)
|
} else if ($.isPush !== false) {
|
||||||
|
console.error('skuTitle解析异常');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}
|
||||||
if (e.message === `Request failed with status code 403`) {
|
console.log(`当前试用组长度为:${trialActivityIdList.length}`);
|
||||||
$.retrynum++
|
console.log(`下一页状态:${data.data.hasNext}`);
|
||||||
if ($.retrynum === 4) {
|
if (data.data.hasNext === false) {
|
||||||
$.isForbidden = true
|
if ($.nowTabIdIndex < args_xh.tabId.length) {
|
||||||
$.log('多次尝试失败,换个时间再试!')
|
$.nowTabIdIndex++;
|
||||||
} else {
|
$.nowPage = 1;
|
||||||
console.log(`403,第 ${$.retrynum} 次重试`)
|
$.nowItem = 1;
|
||||||
}
|
$.retrynum = 0;
|
||||||
} else {
|
} else {
|
||||||
console.log(e.message)
|
// 这下是真的没了
|
||||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
$.retrynum = 999;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$.nowPage++;
|
||||||
|
$.retrynum = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`💩 获得试用列表失败: ${data.message}`);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e.message === `Request failed with status code 403`) {
|
||||||
|
$.retrynum++;
|
||||||
|
if ($.retrynum === 4) {
|
||||||
|
$.isForbidden = true;
|
||||||
|
$.log('多次尝试失败,换个时间再试!');
|
||||||
|
} else {
|
||||||
|
console.log(`403,第 ${$.retrynum} 次重试`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(e.message);
|
||||||
|
console.log(`${$.name} API请求失败,请检查网路重试`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function h5stSign(body, appId, version) {
|
async function h5stSign(body, appId, version) {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
15
jd_video_shua.js
Normal file
15
jd_video_shua.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
96
jd_wsck.py
96
jd_wsck.py
@ -42,29 +42,8 @@ def randomuserAgent():
|
|||||||
|
|
||||||
|
|
||||||
def get_proxy_api(proxy_url, max_retries=5, timeout=60, retry_delay=1):
|
def get_proxy_api(proxy_url, max_retries=5, timeout=60, retry_delay=1):
|
||||||
session = requests.Session()
|
|
||||||
for retry in range(max_retries):
|
for retry in range(max_retries):
|
||||||
if '@' in proxy_url:
|
res = get(url=proxy_url)
|
||||||
# 解析认证信息
|
|
||||||
auth_part, url_part = proxy_url.split('@')
|
|
||||||
protocol = auth_part.split('://')[0]
|
|
||||||
auth_part = auth_part.split('://')[1]
|
|
||||||
host = url_part
|
|
||||||
|
|
||||||
# 处理只有 token 的情况
|
|
||||||
if ':' in auth_part:
|
|
||||||
username, password = auth_part.split(':')
|
|
||||||
session.auth = (username, password)
|
|
||||||
else:
|
|
||||||
# 只有 token 的情况,需要 base64 编码
|
|
||||||
token = auth_part
|
|
||||||
token_b64 = base64.b64encode(token.encode()).decode()
|
|
||||||
session.headers.update({'Authorization': f'Basic {token_b64}'})
|
|
||||||
|
|
||||||
res = session.get(f"{protocol}://{host}", verify=False, timeout=timeout)
|
|
||||||
else:
|
|
||||||
res = session.get(proxy_url, verify=False, timeout=timeout)
|
|
||||||
|
|
||||||
printf(f"本次获取到的代理:{res.text}")
|
printf(f"本次获取到的代理:{res.text}")
|
||||||
proxy_ip_port = res.text.strip()
|
proxy_ip_port = res.text.strip()
|
||||||
proxy_address = f"http://{proxy_ip_port}"
|
proxy_address = f"http://{proxy_ip_port}"
|
||||||
@ -263,7 +242,7 @@ def get_sign_diy(pin):
|
|||||||
|
|
||||||
def getcookie_wskey(key):
|
def getcookie_wskey(key):
|
||||||
proxys = proxy_url
|
proxys = proxy_url
|
||||||
if os.environ.get("DY_PROXY") is not None:
|
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||||
proxys = get_proxy_api(proxy_url)
|
proxys = get_proxy_api(proxy_url)
|
||||||
|
|
||||||
body = "body=%7B%22to%22%3A%22https%3A//plogin.m.jd.com/jd-mlogin/static/html/appjmp_blank.html%22%7D"
|
body = "body=%7B%22to%22%3A%22https%3A//plogin.m.jd.com/jd-mlogin/static/html/appjmp_blank.html%22%7D"
|
||||||
@ -291,7 +270,7 @@ def getcookie_wskey(key):
|
|||||||
printf(f"【错误】{unquote(pin)}在获取token时:\n{error}")
|
printf(f"【错误】{unquote(pin)}在获取token时:\n{error}")
|
||||||
return pin, "False"
|
return pin, "False"
|
||||||
randomuserAgent()
|
randomuserAgent()
|
||||||
if os.environ.get("DY_PROXY") is not None:
|
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||||
proxys = get_proxy_api(proxy_url)
|
proxys = get_proxy_api(proxy_url)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -301,7 +280,7 @@ def getcookie_wskey(key):
|
|||||||
printf(f"【警告】{unquote(pin)}在获取token时失败,等待5秒后重试")
|
printf(f"【警告】{unquote(pin)}在获取token时失败,等待5秒后重试")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
randomuserAgent()
|
randomuserAgent()
|
||||||
if os.environ.get("DY_PROXY") is not None:
|
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||||
proxys = get_proxy_api(proxy_url)
|
proxys = get_proxy_api(proxy_url)
|
||||||
|
|
||||||
if token=="xxx":
|
if token=="xxx":
|
||||||
@ -328,7 +307,7 @@ def getcookie_wskey(key):
|
|||||||
printf(f"【错误】{unquote(pin)}在获取cookie时:\n{error}")
|
printf(f"【错误】{unquote(pin)}在获取cookie时:\n{error}")
|
||||||
return "Error"
|
return "Error"
|
||||||
randomuserAgent()
|
randomuserAgent()
|
||||||
if os.environ.get("DY_PROXY") is not None:
|
if os.environ.get("WSKEY_PROXY_URL") is not None:
|
||||||
proxys = get_proxy_api(proxy_url)
|
proxys = get_proxy_api(proxy_url)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -445,40 +424,34 @@ def getRemark(pt_pin,token):
|
|||||||
|
|
||||||
return strreturn
|
return strreturn
|
||||||
|
|
||||||
def get_latest_file(files):
|
|
||||||
latest_file = None
|
|
||||||
latest_mtime = 0
|
|
||||||
for file in files:
|
|
||||||
try:
|
|
||||||
stats = os.stat(file)
|
|
||||||
mtime = stats.st_mtime
|
|
||||||
if mtime > latest_mtime:
|
|
||||||
latest_mtime = mtime
|
|
||||||
latest_file = file
|
|
||||||
except FileNotFoundError:
|
|
||||||
continue
|
|
||||||
return latest_file
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
printf("版本: 20230602")
|
printf("版本: 20230602")
|
||||||
printf("说明: 如果用Wxpusher通知需配置WP_APP_TOKEN_ONE和WP_APP_MAIN_UID,其中WP_APP_MAIN_UID是你的Wxpusher UID")
|
printf("说明: 如果用Wxpusher通知需配置WP_APP_TOKEN_ONE和WP_APP_MAIN_UID,其中WP_APP_MAIN_UID是你的Wxpusher UID")
|
||||||
printf("隧道型代理池接口:export WSKEY_PROXY_TUNNRL='http://127.0.0.1:123456'")
|
printf("隧道型代理池接口:export WSKEY_PROXY_TUNNRL='http://127.0.0.1:123456'")
|
||||||
printf("拉取型代理API接口(数据格式:txt;提取数量:每次一个):export DY_PROXY='http://xxx.com/apiUrl'")
|
printf("拉取型代理API接口(数据格式:txt;提取数量:每次一个):export WSKEY_PROXY_URL='http://xxx.com/apiUrl'")
|
||||||
printf("没有代理可以自行注册,比如携趣,巨量,每日免费1000IP,完全够用")
|
printf("没有代理可以自行注册,比如携趣,巨量,每日免费1000IP,完全够用")
|
||||||
printf("====================================")
|
printf("====================================")
|
||||||
config=""
|
config=""
|
||||||
envtype=""
|
envtype=""
|
||||||
global proxy_url
|
global proxy_url
|
||||||
proxy_url=os.environ.get("DY_PROXY") or os.environ.get("WSKEY_PROXY_TUNNRL") or None
|
proxy_url=os.environ.get("WSKEY_PROXY_URL") or os.environ.get("WSKEY_PROXY_TUNNRL") or None
|
||||||
iswxpusher=False
|
iswxpusher=False
|
||||||
counttime=0
|
counttime=0
|
||||||
|
|
||||||
|
if os.path.exists("/ql/config/auth.json"):
|
||||||
|
config="/ql/config/auth.json"
|
||||||
|
envtype="ql"
|
||||||
|
if os.path.exists("/ql/data/db/keyv.sqlite"):
|
||||||
|
config="/ql/data/db/keyv.sqlite"
|
||||||
|
envtype="ql_latest"
|
||||||
|
if os.path.exists("/ql/data/config/auth.json"):
|
||||||
|
config="/ql/data/config/auth.json"
|
||||||
|
envtype="ql"
|
||||||
|
|
||||||
|
if os.path.exists("/jd/config/auth.json"):
|
||||||
|
config="/jd/config/auth.json"
|
||||||
|
envtype="arcadia"
|
||||||
|
|
||||||
token_file_list = ['/ql/data/db/keyv.sqlite', '/ql/data/config/auth.json', '/ql/config/auth.json']
|
|
||||||
|
|
||||||
config = get_latest_file(token_file_list)
|
|
||||||
envtype="ql"
|
|
||||||
|
|
||||||
if os.path.exists("/arcadia/config/auth.json"):
|
if os.path.exists("/arcadia/config/auth.json"):
|
||||||
config="/arcadia/config/auth.json"
|
config="/arcadia/config/auth.json"
|
||||||
@ -500,7 +473,7 @@ def main():
|
|||||||
iswxpusher=False
|
iswxpusher=False
|
||||||
|
|
||||||
if proxy_url is None:
|
if proxy_url is None:
|
||||||
printf("没有配置代理,无法使用代理!\n请配置环境变量WSKEY_PROXY_TUNNRL或DY_PROXY\n")
|
printf("没有配置代理,无法使用代理!\n请配置环境变量WSKEY_PROXY_TUNNRL或WSKEY_PROXY_URL\n")
|
||||||
printf("====================================")
|
printf("====================================")
|
||||||
else:
|
else:
|
||||||
printf(f"已配置代理: {proxy_url}\n")
|
printf(f"已配置代理: {proxy_url}\n")
|
||||||
@ -511,16 +484,8 @@ def main():
|
|||||||
summary=""
|
summary=""
|
||||||
|
|
||||||
if envtype == "ql":
|
if envtype == "ql":
|
||||||
if 'keyv' in config:
|
with open(config, "r", encoding="utf-8") as f1:
|
||||||
with open(config, "r", encoding="latin1") as file:
|
token = json.load(f1)['token']
|
||||||
auth = file.read()
|
|
||||||
matches = re.search(r'"token":"([^"]*)"(?!.*"token":)', auth)
|
|
||||||
token = matches.group(1)
|
|
||||||
else:
|
|
||||||
with open(config, "r") as file:
|
|
||||||
auth = file.read()
|
|
||||||
auth = json.loads(auth)
|
|
||||||
token = auth["token"]
|
|
||||||
url = 'http://127.0.0.1:5600/api/envs'
|
url = 'http://127.0.0.1:5600/api/envs'
|
||||||
headers = {'Authorization': f'Bearer {token}'}
|
headers = {'Authorization': f'Bearer {token}'}
|
||||||
body = {
|
body = {
|
||||||
@ -536,7 +501,20 @@ def main():
|
|||||||
url = 'http://127.0.0.1:5678/openApi/count'
|
url = 'http://127.0.0.1:5678/openApi/count'
|
||||||
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ', 'api-token': f'{token}'}
|
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ', 'api-token': f'{token}'}
|
||||||
datas = get(url, headers=headers).json()["data"]["accountCount"]
|
datas = get(url, headers=headers).json()["data"]["accountCount"]
|
||||||
|
elif envtype == "ql_latest":
|
||||||
|
with open(config, "r", encoding="latin1") as f1:
|
||||||
|
content = f1.read()
|
||||||
|
matches = re.search(r'token":"([^"]+)"', content)
|
||||||
|
try:
|
||||||
|
token = matches.group(1)
|
||||||
|
except Exception as e:
|
||||||
|
sys.exit(0)
|
||||||
|
url = 'http://127.0.0.1:5600/api/envs'
|
||||||
|
headers = {'Authorization': f'Bearer {token}'}
|
||||||
|
body = {
|
||||||
|
'searchValue': 'JD_WSCK',
|
||||||
|
'Authorization': f'Bearer {token}'
|
||||||
|
}
|
||||||
datas = get(url, params=body, headers=headers).json()['data']
|
datas = get(url, params=body, headers=headers).json()['data']
|
||||||
|
|
||||||
|
|
||||||
@ -546,7 +524,7 @@ def main():
|
|||||||
printf("\n错误:没有需要转换的JD_WSCK,退出脚本!")
|
printf("\n错误:没有需要转换的JD_WSCK,退出脚本!")
|
||||||
return
|
return
|
||||||
|
|
||||||
if envtype in ('ql',''):
|
if envtype in ('ql','ql_latest'):
|
||||||
for data in datas:
|
for data in datas:
|
||||||
randomuserAgent()
|
randomuserAgent()
|
||||||
if data['status']!=0:
|
if data['status']!=0:
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
7
jd_yc_draw.js
Normal file
7
jd_yc_draw.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user