How to intergrate a single tweet into your website - twitter

Right now im building a simple html/css site for a friend. The homepage is a series of grid block divs that hold some content.
There are currently 3 block divs we have marked for social media posts. So for example, he wants his latest tweet to appear in one of those divs. His latest instagram post to appear in another and facebook in the last.
We can ignore facebook for the time being as I'm only focusing on the twitter/instagram for now.
I'm struggling with where to begin for this project. In the past I have only embedded twitter timelines, Instagram posts using widgets etc....nothing too complicated.
But for this project I will need separate stripped down posts, ie: just the plain text from his tweet inside the twitter div. The image from his Instagram post as the background image on the Instagram block etc...
I've spent the last few hours trying to get my head around oEmbed, and I can safely say I'm failing miserably.
I'm actually more confused now then before I started, so if any kind soul could give me a dummies guide to how I can approach this, that would be absolutely amazing.
Thank you!

You can acheive a single embedded tweet using an embedded timeline.
To get just one tweet, use the data-tweet-limit attribute on the embed tag, as detailed here:
https://dev.twitter.com/web/embedded-timelines/parameters
For example:
<a class="twitter-timeline" href="https://twitter.com/TwitterDev" data-widget-id="some_id" data-tweet-limit="1"></a>
According to twitter's documentation, that is the recommended way of getting tweets onto websites. From your description of the use case, I'd highly recommend just using Twitter's official widget.
If you really want to use Twitter's REST API and generate your page server side, I'd check out this stack overflow question as a starting point:
Setting up Twitter API, getting the last few Tweets
Hope that helps!

Related

Beginner Question: How to access the number of impressions from *other users'* tweets?

I've got a bunch of free online HTML, CSS, and JS tutorials under my belt and I want to try using them to make a browser extension. But I want to make sure that the data I want to use is actually accessible before getting started.
My goal is to make a browser extension for twitter.com that shows the number of impressions of any tweet next to the likes, retweets, and replies. My basic idea is to get the status URL of any given tweet, poll the Twitter API for the number of impressions of that tweet, store that in a variable, and then use CSS to display a little eye icon and the number stored in the impressions variable.
I know that I can find the number of impressions of all of my tweets, both through Twitter Analytics, and also just going to my profile page and clicking the little bar chart icon next to views, retweets, etc. But I'm not clear on whether I can do that for other people's tweets via Twitter's API or anything else. Can you?
For the record, I'm not too concerned about the varying definition of "impression," since it will be consistently applied across all tweets and I'm mostly interested in giving users a comparison between tweets. This is part of a research project to see how this might change how people engage with social media if they know how many views a given post has. If there's a simpler way to go about that using existing platforms, I'm open to suggestions.
Thanks for the advice!
No, impressions data is private. If you are authenticated to the Twitter API then you can use the new Twitter Developer Labs Tweets API to get private metrics like impressions, but you cannot get that for other people's Tweets. Also, the Twitter API does not support CORS, so I don't think you'll be successful trying to use it from a browser extension.

how to get twitter feeds in shopify

I am trying to get twitter feeds in to my shopify site. I want to get the feeds and style them as I want and thus cant use a app.
I know how to do it using PHP but can not use that code in shopify and looking for a way I can use OAuth in shopify and get the feeds. I tried the shopify docs but without an example its kinda hard to actually get my head around it.
http://docs.shopify.com/api/tutorials/oauth
Thats the link I am using as a guide. If anyone can direct me to an example which might be similar that would be awesome. (google didnt seem to be that helpful this time either)
Cheers
I know you said you didn't want to use an app, but can I suggest taking a look at Twitify? You can use custom CSS to style your tweets. Also see discussions about Twitify here and here.
Twitter changed their display guidelines and policies on embedding of tweets on websites in June 2013. One of the themes I used for a client earlier in the year had custom styling of tweets, and they have now changed it to use the official Twitter widget to meet the new guidelines. In fact, the images on the Shopify theme store show how it used to look before Twitter changed things:
And after:
I think using an app like Twitify would be the easiest way to deal with these changes to embedding tweets.
Thanx for the suggestion. I did take a look at that before I posted this question. This is a project for a client and I dont think getting a plug in is a viable option. Anyways I found a work around.
Hosted the file on a server and then accessed it. So that resolved the problem. :)
I used node.js to write the script and get the posts as required.
Cheers.
you can use the app for that Twitify https://apps.shopify.com/twitify or you can Embed a Twitter feed in your online store
Go to your Twitter settings.
Click Widgets to open the widgets menu.
Create a new widget, following Twitter's instructions.
Copy the embed code.

search for and embed youtube videos in ruby on rails application

I have a website where I want to basically allow people to display several youtube videos onto the same page.
For example, I have a friend who has 3 different videos. Instead of sending a link to the three videos individually, they would go to my site see the 3 search boxes, search for the videos individually (the search is done on youtube), then they can pick the videos and click "done", at which point, the 3 videos would be embedded on their page.
I'm trying to figure out how to approach this in ruby on rails, but I'm not finding much information on how.
Here's a link from 2009 of a guy who's saying that he can actually do the search and retrieve from youtube: http://railsforum.com/viewtopic.php?id=30443
But I don't know how to do the search & retrieve, and I don't know how to do the embed. I think I can figure out the embed, but what's the best way to do the search/display results?
Thanks a lot for your help stackoverflow, you're my only hope (besides google, but google failed me today).
all you need to know about the search feature is described in YouTube Data Api. You will need your app to communicate with this API. The best thing to do may be to look after a gem specialized in this ; there is a list available in another StackOverflow question.

How do I display clickable wordpress blog post titles in an UITableView for iOS?

I am working on a iOS application in which I would like users to be able to access a table view list of blog post titles. The blog is self-hosted and runs on the Wordpress platform. The blog is linked to a twitter account so that each time a new post goes live, a new tweet is generated with the post title and the url. I was thinking that I could retrieve the twitter feed and insert the tweets into my table but I don't know if that's the easiest/best way to do it. Does anyone have any ideas?
You might want to setup an RSS to UITableView instead of bringing in the twitter API to do the job for you. If you keep the UITableView dependent on the Twitter API, you are inducing an additional, unwanted level of data dependency. Use RSS and update the UITableViews. You could possibly use this: http://dblog.com.au/iphone-development/rss-reader-part-4-setting-up-the-uitabbar-and-uitableview-with-delegates/ although I'm not sure if this is what you are looking for.

How to add Twitter Expanded Tweets? (was: twitter media preview card for my site?)

I googled a lot about how to make twitter media preview for my website entities if they are linked in a tweet like images below:
Any idea where can I find some documentation about it? Or a tutorial? Is this possible or these media/site previews are hardcoded in twitter?
EDIT:
so, what I need:
If someone links my site on twitter, my widget appear under the tweet, like below:
UPDATE 2012-06-13
It appears this is an Expanded Tweet - -what the requirements are to integrate these expansions into Twitter are do not appear to be displayed - but this sure is interesting.
Nope your in luck. They're not hardcoded into Twitter, they're available in the JSON response. You actually have in your post the word you need to google for entities.
You can add include_entities=1 to the end of most REST api calls and it will give you expanded information about the URL's contained within the JSON. It will split out all the URL's where you can parse out the Youtube links for example. The JSON also includes a special media_url entity but it only works for pictures. In any case, you can still parse out the media easily like youtube with a regex match because you get the URL's split out nicely with this include_entities=1 parameter.
example call :
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&include_entities=1
more documentation : https://dev.twitter.com/docs/tweet-entities
answer edited below based on clarification:
Editing Twitter itself with previews is impossible and it's also ineffective. 75% of traffic to Twitter happens outside of Twitter.com. However the most probable solution to achieving this request would be to download a browser extension.
This extension for example enbales previews of webpages directly in the users stream content preview pane on Twitter.com
https://chrome.google.com/webstore/detail/oijgblonhcagdhfbgjilnpjipmijimmn

Resources