Skip to content

Commit

Permalink
quanx - 重新上传
Browse files Browse the repository at this point in the history
  • Loading branch information
chavyleung committed Dec 28, 2019
1 parent b87791b commit f06e6cd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
14 changes: 7 additions & 7 deletions tieba/quanx/tieba.cookie.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const cookieName = '百度贴吧'
const cookieKey = 'chavy_cookie_tieba'
const cookieVal = $request.headers['Cookie']
const cookieName = "百度贴吧";
const cookieKey = "chavy_cookie_tieba";
const cookieVal = $request.headers["Cookie"];

if (cookieVal) {
let cookie = $prefs.setValueForKey(cookieVal, cookieKey)
let cookie = $prefs.setValueForKey(cookieVal, cookieKey);
if (cookie) {
let msg = `Cookie [${cookieName}] 写入成功!`
$notify(msg, '', '详见日志')
let msg = `Cookie [${cookieName}] 写入成功!`;
$notify(msg, "", "详见日志");
}
}

$done({})
$done({});
39 changes: 22 additions & 17 deletions tieba/quanx/tieba.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
const cookieName = '百度贴吧'
const cookieKey = 'chavy_cookie_tieba'
const cookieVal = $prefs.valueForKey(cookieKey)
const cookieName = "百度贴吧";
const cookieKey = "chavy_cookie_tieba";
const cookieVal = $prefs.valueForKey(cookieKey);

function sign() {
let url = {
url: `http://tieba.baidu.com/f/like/mylike`,
headers: {
Cookie: cookieVal
}
}
$task.fetch(url).then((response) => {
let data = response.body
let regex = /\/f\?kw=([^{'"}]*)/g
};
$task.fetch(url).then(response => {
let data = response.body;
let regex = /\/f\?kw=([^{'"}]*)/g;
let cnt = 0;
for (const bar of data.matchAll(regex)) {
signBar(bar)
cnt += 1;
setTimeout(() => signBar(bar), cnt * 500);
}
})
});
}

function signBar(bar) {
let url = {
url: `http://tieba.baidu.com/sign/add?ie=utf-8&kw=${bar[1]}`,
method: "POST",
headers: { Cookie: cookieVal }
}
$task.fetch(url).then((response) => {
let data = response.body
let result = JSON.parse(data)
};
$task.fetch(url).then(response => {
let data = response.body;
let result = JSON.parse(data);
if (result.no == 0) {
console.log(`正在签到: ${bar[1]}, 签到成功`)
console.log(`正在签到: ${bar[1]}, 签到成功`);
} else {
console.log(`正在签到: ${bar[1]}, 错误编码: ${result.no}, 错误原因: ${result.error}`)
console.log(
`正在签到: ${bar[1]}, 错误编码: ${result.no}, 错误原因: ${result.error}`
);
}
})
});
}

sign()
sign();

0 comments on commit f06e6cd

Please sign in to comment.