Twitter = how to embed a specific tweett + comments? - twitter

I'd like to find out how to embed a specific tweet + comments.
I know how to embed the whole timeline (with Twitter widgets):
<a class="twitter-timeline" href="https://twitter.com/stats_canada" data-widget-id="608870269030137856">Tweets by #stats_canada</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
but I just need to embed one tweet using that widget (if possible).
For example this particular one:
https://twitter.com/stats_canada/status/230694020031078400?s=17

You can embed that specific tweet using this code:
<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">The average Canadian says sorry over 45,000 times a day.</p>— Stats Canada (#stats_canada) August 1, 2012</blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
However, replies are different. The current twitter API doesn't seem to allow for embedding of entire conversations. What you can do after embedding this tweet is getting the embed quote for each reply, and then unchecking the "Include parent tweet" for each embed code. You can then add each one below the original tweet.

Related

What would cause this youtube embed string to stop working?

I save youtube links in a datastore for viewing in batches according to topic.
I basically save the videoid with a caption note and the length data.
I used php to construct a custom viewer. I've been using it for at least 10 months exactly the way I want. One breaking change to the format happened during this time and I was able to adjust to that change.
Now, today, it looks like another breaking change has happened and I'm curious to see if it's my code or if it's youtube's embed syntax.
So here's a list of youtube video id's from the Veritasium channel:
2KZb2_vcNTg,Ux33-5k8cjg,vqDbMEdLiCs,myh94hpFmJY,Iuv6hY6zsd0,vWVZ6APXM4w,BD6h-wDj7bw,1Xp_imnO6WE,38gVZgE39K8,XAgXwUwQoPA,rAYW9n8i-C4
I dynamically construct an iframe with this baseline syntax:
<iframe id="myiframe" class="myplaylist" width="720" height="405" src="https://www.youtube.com/embed/videoseries?playlist= <comma separated list of video id's> &controls=1?enablejsapi=1" frameborder="0" allowfullscreen=""></iframe>
So a functional iframe element created from these two pieces looks this:
<iframe id="myiframe" class="myplaylist" width="720" height="405" src="https://www.youtube.com/embed/videoseries?playlist=2KZb2_vcNTg,Ux33-5k8cjg,vqDbMEdLiCs,myh94hpFmJY,Iuv6hY6zsd0,vWVZ6APXM4w,BD6h-wDj7bw,1Xp_imnO6WE,38gVZgE39K8,XAgXwUwQoPA,rAYW9n8i-C4&controls=1?enablejsapi=1" frameborder="0" allowfullscreen=""></iframe>
This won't work as a snippet, but as an html element, it should show a youtube player, and in the upper right show a counter and drop down list of the queued videos as though you were looking at a playlist on the youtube site.
For example (Except this one is demonstrating the new problem):
It would help if someone would try this completed tag, and see if the embedded player functions.
I can't tell what's gone wrong.
I think it's YouTube. I don't know whether it is intended or a bug, but something certainly changed on YouTube's end.
If you copy the URL of the video it is https://youtu.be/videoseries - YouTube no longer recognizes /videoseries as a special URL and simply tries loading it as if it were a video slug at the front of the playlist.
It looks like a potential workaround is simply removing videoseries from the embed URL, like this:
<iframe id="myiframe" class="myplaylist" width="720" height="405" src="https://www.youtube.com/embed/?playlist=2KZb2_vcNTg,Ux33-5k8cjg,vqDbMEdLiCs,myh94hpFmJY,Iuv6hY6zsd0,vWVZ6APXM4w,BD6h-wDj7bw,1Xp_imnO6WE,38gVZgE39K8,XAgXwUwQoPA,rAYW9n8i-C4&controls=1?enablejsapi=1" frameborder="0" allowfullscreen=""></iframe>
According to a client whose embedded YouTube videos broke in the same manner today, when he reviewed a playlist in his YouTube account today there is now a new URL provided for embedding it. We replaced the old URL with the new one and the problem is fixed.
New URL is of the format https://www.youtube.com/embed/<new id code>
Old URL is of the format https://www.youtube.com/embed/videoseries?list=<old id code>

Dynamic timeline selection for embedded timelines - Hashtag Timeline

I've followed the guide here to add multiple widgets using the same widget id and this works perfectly fine for User timeline.
Snippet ----
<a class="twitter-timeline" href="https://twitter.com/benward" data-widget-id="[id]" data-screen-name="benward">
<a class="twitter-timeline" href="https://twitter.com/endform" data-widget-id="[id]" data-screen-name="endform">
<a class="twitter-timeline" href="https://twitter.com/kang" data-widget-id="[id]" data-screen-name="kang">
<a class="twitter-timeline" href="https://twitter.com/brianellin" data-widget-id="[id]" data-screen-name="brianellin">
What I would want to do is do the same( show different widgets ) for multiple hashtags - #MH17, #MH370 on the same page. But these tags change for each article on a page.
I want to know if either of these is possible.
Can I make the same guide available for a search query to this and this without creating a widget manually from the Twitter page. Timeline changes when I change the "data-screen-name" property. Is there something like "data-hashtag-name"?
Is it possible to use Twitter API or something to automate the process of creating a widget from the browser using Auth Token - Secret?
May be this help you .
Here i am sending you some example using this I am get json and render html div
Here is a sample code and demo you can use for search in twitter
1) http://www.codexworld.com/create-custom-twitter-widget-using-php/
2)you can also look into this examle may be this will full fill your requirement .
http://dev.kim-maida.com/twitter/
3) here is demo code and code sample link.
https://github.com/kmaida/twitter-timeline-php
did you see these pages?
https://dev.twitter.com/web/embedded-timelines/search
https://twitter.com/settings/widgets/new/search
You can do this:
corgi is the sample hashtag:
<a class="twitter-timeline" href="https://twitter.com/hashtag/corgi" data-widget-id="612280670367301632">#corgi Tweets</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

Twitter feed widget not working

Hello I am having some issue with the Twitter Feed Widget. After editing it I copy the code and put it on my page:
<div>
<a class="twitter-timeline" href="https://twitter.com/TimIDCA" data-widget-id="302125789070102528">Tweets by #TimIDCA</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
but this error pops up in my console:
Failed to load resource http://cdn.syndication.twimg.com/widgets/timelines/302125789070102528?domai…ack=twttr.tfw.callbacks.tl_302125789070102528&suppress_response_codes=true
What do I do?
The only thing that shows up is the link: Tweets by #TimIDCA
Go back to twitter where you configured the widget and set the domain you intend to use the widget in. You can list multiple domains. For example:
*.stewardxpress.com, *.ihnbc.com
Where * is a wildcard for any subdomain you might have and want to apply the widget to. Reload and it should be working. At least, I've fixed two non-functional widgets by doing just this.

Twitter's share ignores my data-url and data-text

Whatever I set data-url or data-text to, twitter just fetches the URL of the page the sharing button exists in and shows as the tweet-text.
example :
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="http://www.gogole.com"
data-text="BLABLABLA" style="opacity:0">TWEET</a>
or
<a target="_blank" href="https://twitter.com/share"
data-count="none" class="twitter-share-button" data-url="<?php echo
urlencode('http://www.gogole.com')?>" data-text="BLABLABLA" style="opacity:0">TWEET</a>
in both cases, clicking on the link opens a new window with the twitter sharing box that includes the URL of my website and ignores the attributes I set.
Something should have gone dangly wrong. help appreciated !
please tell me if you need more info to be posted.
Thanks,
/t
You can use the query parameter "url" with the twitter share link "https://twitter.com/share"
When looking for the URL twitter button follow this priority:
Look for url in the share link query string
If not found, look for the data-url attribute of the Tweet Button anchor tag
If not found, look for the rel="canonical" link tag in the head of the document
If not found use the URL of the webpage
I have faced same issue - when using link as described in manual's example it didnt work.
this NOT works:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share" data-text="my_title" data-url="my_url" data-hashtags="my_hash" data-via="my_name" data-related="my_name">Tweet</a>
but this WORKS:
<a class="twitterBtn smGlobalBtn" target=_blank href="https://twitter.com/share?text=my_text&url=my_url&hashtags=my_hash&via=my_name&related=my_name">Tweet</a>
Don't know why twitter ignores data- attributes, but when params are inside the link as GET params - everything works fine.
Hope this will be helpful for someone in future)
I fixed this by moving script widgets.js before button markup and turning off async mode, like this:
<script src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-text="H..." />
twitter-share-button class also important.

Twitter - tweet button API

I'm looking into using the Twitter tweet button API, found: here
I have the following code:
<a href="http://twitter.com/share" class="twitter-share-button"
data-url="http://myurl.com/howtouse"
data-counturl="http://myurl.com/howtouse"
data-text="How to use this site"
data-count="vertical"
>Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
My problem comes with the count. When I hit the 'tweet' button, the popup appears. I post to twitter all fine. The problem then comes with when I then click on the count box, which is 0.
The URL of this is: http://twitter.com/#search?q=http%3A%2F%2Fmyurl.com%2Fhowtouse%2F
Which when clicked returns no results even though I can see the tweet in my timeline.
Does anyone have any ideas why the search wouldn't find the link I shared/tweeted and why the count is 0?
Thanks
There are a number of reasons that Tweets don't show up in search that range from quality filtering to time: http://support.twitter.com/articles/66018-my-tweets-or-hashtags-are-missing-from-search
The tweet count being 0 can be an effect of caching. Generally tweet button counts take a few hours to update for performance reasons and are often inaccurate by a % as well.

Resources