0

I used Feedburner to automatically tweet new posts on my blog, but Feedburner stopped working and I want to write my own code to do the same.

The Feedburner tweets looked like this: the post title followed by a short excerpt and a clickable image pointing to the blog post. The URL for the blog post is not included in the body of the tweet.

Can I do the same with the Twitter API, preferably using Python?

I've looked at the docs of both python-twitter PostUpdate() and Twitter API, but I could not achieve the same result. At most I could publish a tweet with the image, but without a link to the blog post.

# api_twitter = twitter.API( ...
msg = "My tweet message body."
img = "https://[...].jpg"
status = api_twitter.PostUpdate(status=msg, media=img)
Ricardo
  • 59
  • 1
  • 3
  • That's using Twitter cards, where the target webpage includes metadata that defines the image to show. Check the documentation on this https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards.html – Andy Piper Jun 24 '19 at 15:02
  • The URLs I post on Twitter are already optimized for cards. I've already seen the documentation you provided, but it doesn't say how to post a "Twitter card" using the Twitter API and achieving the same result as Feedburner (i.e., the card appearing in the tweet but without the URL appearing in the tweet body). – Ricardo Jun 25 '19 at 16:21

1 Answers1

1

I've found the problem - I should NOT use the media parameter at all in the PostUpdate() call, and just let Twitter itself fetch all Card data from the URL I provided at the end of status. The Card will be displayed, but not the URL.

Ricardo
  • 59
  • 1
  • 3