mirror of
https://github.com/qitoqito/psyduck.git
synced 2026-01-12 21:20:43 +08:00
.
This commit is contained in:
parent
3baf6569ba
commit
ea28fb7b4f
87
parse/jd/jd_task_rmFavorite.js
Normal file
87
parse/jd/jd_task_rmFavorite.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import {Template} from '../../template.js'
|
||||||
|
|
||||||
|
export class Main extends Template {
|
||||||
|
constructor() {
|
||||||
|
super()
|
||||||
|
this.profile = {
|
||||||
|
title: '京东取消商品收藏',
|
||||||
|
delay: 1200,
|
||||||
|
interval: 3000,
|
||||||
|
prompt: {
|
||||||
|
whiteList: '保留关键词,关键词1|关键词2',
|
||||||
|
blackList: '只删除关键词,关键词1|关键词2',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepare() {
|
||||||
|
}
|
||||||
|
|
||||||
|
async main(p) {
|
||||||
|
let user = p.data.user;
|
||||||
|
let context = p.context;
|
||||||
|
let page = 1
|
||||||
|
for (let i = 0; i<6; i++) {
|
||||||
|
let s = await this.curl({
|
||||||
|
'url': `https://api.m.jd.com/?appid=jd-cphdeveloper-m&functionId=queryFollowProduct&body={"cp":${page},"pageSize":20,"category":"","promote":0,"cutPrice":0,"coupon":0,"stock":0,"tenantCode":"jgm","bizModelCode":"6","bizModeClientType":"M","externalLoginType":"1"}&loginType=2&uuid=40501164094171678865533299&openudid=40501164094171678865533299&sceneval=2&g_login_type=1&g_tk=646642342&g_ty=ajax&appCode=msd95910c4`,
|
||||||
|
user,
|
||||||
|
algo: {
|
||||||
|
appId: "c420a",
|
||||||
|
status: true,
|
||||||
|
expire: {
|
||||||
|
"errorCode": 101
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (this.haskey(s, 'followProductList')) {
|
||||||
|
p.log("当前商品收藏数:", s.totalNum)
|
||||||
|
if (s.totalNum>0) {
|
||||||
|
page = Math.ceil(s.totalNum / 20)>1 ? this.rand(1, Math.ceil(s.totalNum / 20)) : 1
|
||||||
|
// commTitle
|
||||||
|
if (this.profile.whiteList) {
|
||||||
|
let whiteList = this.profile.whiteList
|
||||||
|
var data = s.followProductList.filter(d => !d.commTitle.match(whiteList))
|
||||||
|
}
|
||||||
|
else if (this.profile.blackList) {
|
||||||
|
let blackList = this.profile.blackList
|
||||||
|
var data = s.followProductList.filter(d => d.commTitle.match(blackList))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var data = s.followProductList
|
||||||
|
}
|
||||||
|
if (data.length>0) {
|
||||||
|
p.log(`正在删除:`, this.column(data, 'commTitle').join("|"))
|
||||||
|
let rm = await this.curl({
|
||||||
|
'url': `https://api.m.jd.com/api?functionId=batchCancelFavorite&body={"skus":"${this.column(data, 'commId').join(",")}"}&appid=follow_for_concert&client=pc`,
|
||||||
|
user
|
||||||
|
}
|
||||||
|
)
|
||||||
|
p.log(rm.resultMsg)
|
||||||
|
p.info.work = true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.log("没有获取关注数据")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (s.totalNum<20) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.haskey(s, 'totalNum', 0)) {
|
||||||
|
p.log("没有可删除的收藏")
|
||||||
|
p.info.work = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.log("可能黑ip了,没有获取到数据")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -28,7 +28,12 @@ export class Main extends Template {
|
|||||||
form: 'functionId=getFollowShop&body={"page":1,"activityStatus":1,"refresh":false,"pageSize":20,"channel":"jg_shop"}&t=1721701312676&appid=shop_m_jd_com&clientVersion=13.1.2&client=wh5&screen=1170*2532&uuid=1d2057c82bc10bed6b30fcf24c8ede39&loginType=2&x-api-eid-token=jdd03BEKUSIICX7NIA2GGINTXC5QERR6B54KI6TFAJ7B4DI337FEFP4DTEMJ2Z7PKJQUV4OH6P3U74CEGNVTDWIZGD4JSXIAAAAMQ3VSF6CQAAAAACYUXLQXVUJSGIYX',
|
form: 'functionId=getFollowShop&body={"page":1,"activityStatus":1,"refresh":false,"pageSize":20,"channel":"jg_shop"}&t=1721701312676&appid=shop_m_jd_com&clientVersion=13.1.2&client=wh5&screen=1170*2532&uuid=1d2057c82bc10bed6b30fcf24c8ede39&loginType=2&x-api-eid-token=jdd03BEKUSIICX7NIA2GGINTXC5QERR6B54KI6TFAJ7B4DI337FEFP4DTEMJ2Z7PKJQUV4OH6P3U74CEGNVTDWIZGD4JSXIAAAAMQ3VSF6CQAAAAACYUXLQXVUJSGIYX',
|
||||||
user,
|
user,
|
||||||
referer: 'https://shop.m.jd.com/favorite/home',
|
referer: 'https://shop.m.jd.com/favorite/home',
|
||||||
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.33(0x18002129) NetType/WIFI Language/zh_CN miniProgram/wx91d27dbf599dff74"
|
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.33(0x18002129) NetType/WIFI Language/zh_CN miniProgram/wx91d27dbf599dff74",
|
||||||
|
algo: {
|
||||||
|
expire: {
|
||||||
|
code: "3"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (this.haskey(s, 'result.showShopList')) {
|
if (this.haskey(s, 'result.showShopList')) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user