Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Twitter Shortcode: Include preview of the tweet #89

Open
danielbachhuber opened this issue Sep 22, 2015 · 3 comments
Open

Twitter Shortcode: Include preview of the tweet #89

danielbachhuber opened this issue Sep 22, 2015 · 3 comments

Comments

@danielbachhuber
Copy link
Contributor

Twitter's oEmbed implementation returns a nice blockquote to show until the tweet is loaded. It would be cool if our shortcode did the same.

Previously #80

@montchr
Copy link
Contributor

montchr commented Nov 17, 2015

Would this be dependent on the Twitter API? Before we started using Shortcake Bakery, we had a custom implementation of Twitter embeds using the Codebird library to get the tweet content for the blockquote. I'll probably be working on this for our setup in the near future (dependent on Codebird), so if you'd like, I can try to make it work for Shortcake Bakery too, and will submit a PR.

Since we're not handling the Twitter embeds with a custom implementation anymore, I wouldn't mind losing the Codebird dependency if it's possible to get that data without the API wrapper.

@danielbachhuber
Copy link
Contributor Author

Would this be dependent on the Twitter API?

Twitter's oEmbed API (which doesn't require authentication) returns enough data to provide the fallback:

{
  "cache_age": "3153600000",
  "url": "https://twitter.com/Interior/status/507185938620219395",
  "provider_url": "https://twitter.com",
  "provider_name": "Twitter",
  "author_name": "US Dept of Interior",
  "version": "1.0",
  "author_url": "https://twitter.com/Interior",
  "type": "rich",
  "html": "<blockquote class=\"twitter-tweet\"><p>Happy 50th anniversary to the Wilderness Act! Here's a great wilderness photo from <a href=\"https://twitter.com/YosemiteNPS\">@YosemiteNPS</a>. <a href=\"https://twitter.com/hashtag/Wilderness50?src=hash\">#Wilderness50</a> <a href=\"http://t.co/HMhbyTg18X\">pic.twitter.com/HMhbyTg18X</a></p>— US Dept of Interior (@Interior) <a href=\"https://twitter.com/Interior/status/507185938620219395\">September 3, 2014</a></blockquote>\n<script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>",
  "height": null,
  "width": 550
}

@montchr
Copy link
Contributor

montchr commented Nov 17, 2015

Ah. Then I'll probably go this route. If it's still an issue here, I'll open a PR when I get to that point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants