Twint:CRITICAL:root:twint.feed:Follow:IndexError 对于任何调用
Twint: CRITICAL:root:twint.feed:Follow:IndexError for any call
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
这不仅仅是追随者。无论我尝试什么,我都会遇到类似的错误。
运行 Python 3.8.1 Windows 10
Twint - 最新版本 - 2.1.21
看起来可以回答 here。
That's because twitter killed the no js (mobile version) version of twitter on 15th December. Followers were scraped using that version.
事实上,看起来下面的推特解析器使用了 html processing(BeautifulSoup 正如我们所见)。
还有一个workaround,里面有描述。可能它也死了,因为我们在描述中看到了网站的 nojs 版本。
看来,你必须使用 Twitter API。
另外下次您可以只跟踪您的请求而不是在这里提问,看看实际发生了什么。 Wireshark 可能对 https 有点困难,但您可以直接从 python 挂钩请求。这是一个例子:Log all requests from the python-requests module.
Legacy mobile Twitter version will shut down on December 15th 2020. (M2 mobile web)
这是一个 reddit 线程的标题,讨论最近 关闭 M2 移动网络 ("Legacy") Twitter 版本;从此日起,Twitter 将仅支持 these browsers.
如果你看一下 GitHub repository of Twint:
_usr.followers = int(ur['data']['user']['legacy']['followers_count'])
...它使用 legacy
属性,因此从 2020 年 12 月 15 日起将不起作用。
GitHub 回购的贡献者,即 @himanshudabas, also mentioned this in a reply to an identical issue:
That's because twitter killed the no js (mobile version) version of twitter on 15th December. Followers were scraped using that version.
你是 not the only one facing this problem(很明显),不幸的是,对于 Twint 模块,没有解决方法 (目前?).
说到目前的情况,您需要使用官方 Twitter API 或替代包装器/非官方 APIs.
克隆 twint 的 git 存储库而不是 pip install 可以。可以使用 python 脚本而不是命令行检索任何推文。
git clone --depth=1 https://github.com/twintproject/twint.git
cd twint
pip3 install . -r requirements.txt
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
这不仅仅是追随者。无论我尝试什么,我都会遇到类似的错误。
运行 Python 3.8.1 Windows 10
Twint - 最新版本 - 2.1.21
看起来可以回答 here。
That's because twitter killed the no js (mobile version) version of twitter on 15th December. Followers were scraped using that version.
事实上,看起来下面的推特解析器使用了 html processing(BeautifulSoup 正如我们所见)。
还有一个workaround,里面有描述。可能它也死了,因为我们在描述中看到了网站的 nojs 版本。
看来,你必须使用 Twitter API。
另外下次您可以只跟踪您的请求而不是在这里提问,看看实际发生了什么。 Wireshark 可能对 https 有点困难,但您可以直接从 python 挂钩请求。这是一个例子:Log all requests from the python-requests module.
Legacy mobile Twitter version will shut down on December 15th 2020. (M2 mobile web)
这是一个 reddit 线程的标题,讨论最近 关闭 M2 移动网络 ("Legacy") Twitter 版本;从此日起,Twitter 将仅支持 these browsers.
如果你看一下 GitHub repository of Twint:
_usr.followers = int(ur['data']['user']['legacy']['followers_count'])
...它使用 legacy
属性,因此从 2020 年 12 月 15 日起将不起作用。
GitHub 回购的贡献者,即 @himanshudabas, also mentioned this in a reply to an identical issue:
That's because twitter killed the no js (mobile version) version of twitter on 15th December. Followers were scraped using that version.
你是 not the only one facing this problem(很明显),不幸的是,对于 Twint 模块,没有解决方法 (目前?).
说到目前的情况,您需要使用官方 Twitter API 或替代包装器/非官方 APIs.
克隆 twint 的 git 存储库而不是 pip install 可以。可以使用 python 脚本而不是命令行检索任何推文。
git clone --depth=1 https://github.com/twintproject/twint.git
cd twint
pip3 install . -r requirements.txt