import twint
import os, requests, re, time
c = twint.Config()
c.Username = <anyusername> #Replace with an actual uname in quotes
c.Store_object = True
c.Limit = 10
try:
twint.run.Followers(c)
except:
print("Unexpected error:", sys.exc_info()[0])
f = twint.output.follows_list
print(f)输出
CRITICAL:root:twint.feed:Follow:IndexError
[]做过
pip install twint
pip install --upgrade -e git+https://github.com/twintproject/twint.git@origin/master#egg=twint 在谷歌上,很多人都遇到了这个错误--但我真的找不到解决办法。
运行twint命令行也会出现相同的错误。
twint -u <uname> --followers
CRITICAL:root:twint.feed:Follow:IndexError这不仅仅是追随者。无论我尝试什么,我都会犯一个类似的错误。
在Windows 10上运行Python3.8.1
Twint -最新版本- 2.1.21
发布于 2021-01-03 20:06:32
这是一篇关于最近发布的 Mobile (“遗产”) Twitter版本的M2关机事件的头条新闻;从这一天起,推特上只会支持这些浏览器。
如果你看一下Twint的GitHub存储库
_usr.followers = int(ur['data']['user']['legacy']['followers_count'])..。它使用legacy属性,因此从2020年12月15日起就不能工作了。
GitHub回购的贡献者,即https://github.com/himanshudabas,在回复中也提到了这一点,即相同的问题。
这是因为twitter在12月15日杀死了twitter的no js (移动版)版本。追随者都是用那个版本被刮掉的。
您是不是唯一一个面临这个问题的人 (很明显),不幸的是,对于Twint模块,没有解决办法,(当前?)
说到当前的情况,您需要使用官方的Twitter或替代包装器/非官方API。
发布于 2021-01-03 19:38:17
看来可以用这里来回答了。
That's because twitter killed the no js (mobile version) version of twitter on 15th December. Followers were scraped using that version.实际上,下面的twitter解析器使用了html处理 (我们看到的BeautifulSoup)。
还有一个解决办法,它在这里描述了。很可能,它也死了,因为我们在描述中看到了nojs版本的站点。
看起来,您必须使用Twitter。
下一次,您可以只跟踪请求,而不是在这里询问问题,看看实际发生了什么。也许Wireshark使用https可能有点困难,但是您可以直接从python挂钩请求。下面是一个例子:记录python请求模块中的所有请求。。
发布于 2021-03-21 10:19:35
复制twint的git回购而不是pip安装工程。可以使用python脚本而不是命令行检索任何tweet。
git clone --depth=1 https://github.com/twintproject/twint.git
cd twint
pip3 install . -r requirements.txthttps://stackoverflow.com/questions/65453234
复制相似问题