Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save raineydavid/4ef6ec09de90f18218c019ea22ddac26 to your computer and use it in GitHub Desktop.

Select an option

Save raineydavid/4ef6ec09de90f18218c019ea22ddac26 to your computer and use it in GitHub Desktop.
Mass embed twitter threads
// Open the Chrome inspector, and select the topmost div containing the twitter thread.
// You might want to open the first tweet in the thread, scroll down to load every item in the thread, then select the parent container
var foo = document.createElement("div");
var str = ""
$($0).find(".tweet").each(function(i, t) {
var tweet = $(t);
var turl = "https://twitter.com" + tweet.data("permalink-path")
var tdate = tweet.find(".tweet-timestamp").attr("title")
var tcontent = tweet.find(".tweet-text").html()
str += '<blockquote class="twitter-tweet" data-conversation="none" data-lang="en"><p lang="en" dir="ltr">' + tcontent + '</p>&mdash; Better Toronto (@betteryyz) <a href="' + turl + '">' + tdate + '</a></blockquote>\n\n';
});
foo.innerHTML = str
// type foo and right click to select. Congrats! Don't forget to add a
// <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
// at the bottom of wherever you post it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment