Open xingpingcn opened 1 year ago
顶顶,我也是被封号了,移动版微博不能爬取关注列表
@xingpingcn @wocattree 用gpt修改了一版,可以从普通网页提取:https://github.com/BurningUDream/weiboBatchFollow
(() => {
const follows = []
const sleep = time => () => new Promise(resolve => setTimeout(resolve, time))
const query = page =>
fetch(
`/ajax/profile/followContent?page=${page}&next_cursor=50`,
{ headers: { 'X-XSRF-TOKEN': (document.cookie.match(/XSRF-TOKEN=([^;$]+)/) || [])[1] || '' } }
)
.then(response => response.json())
.then(body => {
const { data, msg, ok } = body
if (data.follows.users.length == 0) return Promise.reject(new Error('finish'))
data.follows.users.forEach(user => user && follows.push(user.id))
})
const polling = (page = 1) => query(page).then(sleep(1500)).then(() => polling(page + 1))
polling()
.catch(error => console.warn(`${error.message === 'finish' ? '获取完成' : `出错了 (${error.message})` }\n\n${JSON.stringify(follows)}`))
})()
电脑版微博可用
因为某些原因不能登录移动版微博,当时能登录电脑版微博,这种情况下怎么样获取关注列表?