Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

因为某些原因不能登录移动版微博,当时能登录电脑版微博,这种情况下怎么样获取关注列表? #23

Open
xingpingcn opened this issue Jul 1, 2023 · 3 comments

Comments

@xingpingcn
Copy link

因为某些原因不能登录移动版微博,当时能登录电脑版微博,这种情况下怎么样获取关注列表?

@wocattree
Copy link

顶顶,我也是被封号了,移动版微博不能爬取关注列表

@BurningUDream
Copy link

@xingpingcn @wocattree 用gpt修改了一版,可以从普通网页提取:https://github.com/BurningUDream/weiboBatchFollow

@Crwing
Copy link

Crwing commented Dec 2, 2023

(() => {
	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)}`))
})()

电脑版微博可用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants