问题
I'm trying to send an image in direct message using python + tweepy but no luck. It showed as a link in incoming messages.
imgurl = 'https://t.co/***'
api.send_direct_message(screen_name='username',text=' '+imgurl)
Could you please advise? Official Twitter API doesn't shed a light for me as well.
回答1:
At the moment, you are sending a link. Literally a status message where the text is a URL.
Sadly, Twitter don't provide API access for uploading images via DM.
If you are able to use Twitter's private API, you should be able to attach a media_id
to your DM. But other than that, you're out of luck.
Sorry.
来源:https://stackoverflow.com/questions/37345016/how-to-send-an-image-in-direct-message