How to post links with the twitter API?

2019-08-05 09:49发布

I'm using the twitter API, but when I post links they are showing up as text and not links. I haven't been able to find the documentation showing how to post a link that actually works.

标签: api rest twitter
2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-05 10:16

If you don't keep the prefix (http://) and just post something like www.google.com, the link won't be picked up.

查看更多
做个烂人
3楼-- · 2019-08-05 10:37

If the URL contains special characters you need encode it before posting to Twitter so it will be converted to a link:

from urllib import quote
url = quote(url)
查看更多
登录 后发表回答