Twython 有 140 个 twitter 字符限制 [英] Twython with 140 character limitation of twitter

查看:22
本文介绍了Twython 有 140 个 twitter 字符限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Tython 在 twitter 中进行搜索,但该库似乎限制了 140 个字符.有了python的新特性,即280个字符的长度,可以做什么?

I am trying to search in twitter using Tython, but it seems that the library has a limitation on 140 characters. With the new feature of python, i.e. 280 characters length, what can one do?

推荐答案

这不是 Twython 的限制.默认情况下,Twitter API 返回旧的 140 个字符的有限推文.要查看更新的扩展推文,您只需将此参数提供给您的搜索查询:

This is not a limitation of Twython. The Twitter API by default returns the old 140-character limited tweet. In order to see the newer extended tweet you just need to supply this parameter to your search query:

tweet_mode=extended

然后,您将在返回推文的 full_text 字段中找到 280 个字符的扩展推文.

Then, you will find the 280-character extended tweet in the full_text field of the returned tweet.

我使用另一个库(TwitterAPI),但我认为你会使用 Twython 做这样的事情:

I use another library (TwitterAPI), but I think you would do something like this using Twython:

results = api.search(q='pizza',tweet_mode='extended')
for result in results['statuses']:
    print(result['full_text'])

这篇关于Twython 有 140 个 twitter 字符限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆