All-Nude Tweets (Hacking Extraneous Content from Twitter Embeds)

The Twitter default is for “cards” and “conversation” to display, but you can get rid of them either tweet by tweet or through a copy-paste-search-and-replace-re-copy-paste.

Intro

When you embed a tweet from its URL – for example, for this tweet from Justin Tiehen’s list of explanations for the rise of Donald Trump

https://twitter.com/jttiehen/status/735315944428310528

…it will, by the magic of oEmbed, produce the following display in your WordPress page1:

Tweet with conversation and card

Tweet with “Conversation” and “Card”

Now, a lot of the time, this is totally superduper: You’re happy to include the replied-to tweet, and the part down below, with the image of Mr. Trump there linking to the original article (in a real tweet embed, not the screenshot version of it I’ve used above), is very nifty and even useful, and the nifty formatting is also nifty: Altogether just what your nifty users want.

In some contexts, however, all of the extra stuff is just distracting – especially if you’re showing a long list of tweets or rendering a conversation.2

What follows is a hacky way to grab naked tweets instead.

Grabbing Naked Tweets

The top part of the tweet imaged above (showing a compressed “replied-to” tweet that mentions “pornography”) is “conversation.” The bottom part is “the card.”

If you’re using the oEmbed method, you can bring up the the page source and find something like the below buried in all of the code. (If you’re using Twitter’s more laborious but flexible “Embed” sub-menu, you’ll get something similar.)

The last line is a call to the Twitter Javascript file that adds all the nifty formatting. It needs to be invoked only once per page, but, in a list of 100 tweets embedded by hand, it will be listed 100 times, in 100 paragraphs that will be “un-displayed.”

Twitter also supplies users you with a relatively cumbersome way of getting rid of cards and conversation: When, instead of oEembedding from the URL (i.e., using built-in WordPress oEmbed functionality), you use the Twitter-supplied “embed” code, and you un-check the “include parent conversation” checkbox, you can get rid of the replied-to tweet. The code will look like this:

Producing a display like this:

Tweet with Card, but no Conversation

Tweet with Card, but no Conversation

The only difference between the two Twitter-supplied versions is visible in the first line: the data-conversation="none"  added to the  blockquote .

So, it turns out, the simple hacky way to produce a set of fancy tweets 1) without “conversation,” 2) without redundant calls to the twitter platform (slows things down a lot on a long list), and 3) in a “hard copy” form that is savable even if the user deletes the tweet or Twitter does, is

  1. Copy-paste the tweets as rendered from page source into a text editor.
  2. Use a search-and-replace to add data-conversation="none"  to every blockquote  (as in the example above).
  3. Search and replace (with nothing) all but one of the <p><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
  4. Copy-paste the “cured” text into your HTML panel in place of what you currently have there (i.e., bunch of Twitter URLs or Embeds).

To make the Twitter Card also disappear, you include data-cards="hidden" . So…

…should display like this:

Tweet with "Conversation" and "Card" suppressed

Tweet with “Conversation” and “Card” suppressed

Summary: The Twitter default is for cards and conversation to display, but you can turn them off either tweet by tweet or through a copy-paste-search-and-replace-re-copy-paste.3

Someday…

…I’ll look further into automating this “curing” process… If somebody has done it already – let me know!

Notes:

  1. …as of this writing – Twitter may change its mind without memo-ing me personally []
  2. Multiple redundant “asynchronous” Javascript calls seem also to slow down page rendering – something to be tested at some point. []
  3. Note: You can delete the data-width=”550″ or you can adjust it to a lower value than 550. Higher values will have no effect, or, if mistyped, will break the formatting script. The Twitter embed size CAN be overriden, but you need to work from another direction. []
Lanced Infinity

WordPresser
Home Page Public Email Twitter Facebook YouTube Github  

WordPresser: Writing since ancient times, blogging, e-commercing, and site installing-designing-maintaining since 2001.

Posted in Using WordPress Tagged with: ,

0 comments on “All-Nude Tweets (Hacking Extraneous Content from Twitter Embeds)

Commenting at CK MacLeod's

We are determined to encourage thoughtful discussion, so please be respectful to others. We also provide a set of Commenting Options - comment/commenter highlighting and ignoring, and commenter archives that you can access by clicking the commenter options button (). Go to our Commenting Guidelines page for more details, including how to report offensive and spam commenting.

1 Pings/Trackbacks for "All-Nude Tweets (Hacking Extraneous Content from Twitter Embeds)"
  1. […] few months ago, I noted a technique for stripping Twitter embeds of extraneous conversation, involving setting the tweet attribute “data-conversation” to “none.” What […]

Commenter Ignore Button by CK's Plug-Ins

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Related Posts:

Noted & Quoted

(0)

President Trump's former campaign chairman Paul Manafort, secretly worked for a Russian billionaire to advance the interests of Russian President Vladimir Putin a decade ago and proposed an ambitious political strategy to undermine anti-Russian opposition across former Soviet republics.

The allegations, if true, would appear to contradict assertions by the Trump administration and Manafort himself that he never worked for Russian interests.

Manafort proposed in a confidential strategy plan as early as June 2005 that he would influence politics, business dealings and news coverage inside the United States, Europe and the former Soviet republics, even as US-Russia relations under Republican President George W. Bush grew worse.

Manafort pitched the plans to Russian aluminum magnate Oleg Deripaska, a close Putin ally with whom Manafort eventually signed a $10 million (£8 million) annual contract beginning in 2006, according to interviews with several people familiar with payments to Manafort and business records obtained by the AP.

Comment →
(0)

The texts, posted on a darknet website run by a hacktivist collective, appear to show Manafort’s family fretting about the ethics, safety and consequences of his work for Yanukovych. And they reveal that Manafort’s two daughters regarded their father’s emergence as a key player on Trump’s presidential campaign with a mixture of pride and embarrassment.

In one exchange, daughter Jessica Manafort writes “Im not a trump supporter but i am still proud of dad tho. He is the best at what he does.” Her sister Andrea Manafort responded by referring to their father’s relationship with Trump as “The most dangerous friendship in America,” while in another exchange she called them “a perfect pair” of “power-hungry egomaniacs,” and asserted “the only reason my dad is doing this campaign is for sport. He likes the challenge. It's like an egomaniac's chess game. There's no money motivation.”

By contrast, the Manafort daughters and their mother seemed much more unsettled about Paul Manafort’s work as a political consultant for Yanukovych’s Russia-backed Party of Regions, which is a subject of renewed interest among investigators probing possible links between Trump’s campaign and Russia.

In one March 2015 exchange that appears to be between the two sisters, Andrea Manafort seems to suggest that their father bore some responsibility for the deaths of protesters at the hands of police loyal to Yanukovych during a monthslong uprising that started in late 2013.

“Don't fool yourself,” Andrea Manafort wrote. “That money we have is blood money.”

Comment →
(1)

If there's anything mitigating the bad news for the White House here, it is that Comey may have also sent subtle signals that the matters under investigation are not principally about the personal conduct of Trump himself. While this is speculation, I do not believe that if Comey had, say, validated large swaths of the Steele dossier or found significant Trump-Russia financial entanglements of a compromising variety, he would have said even as much as he said today. I also don't think he would have announced the scope of the investigation as about the relationship "between individuals associated with the Trump campaign and the Russian government" or "coordination between the campaign and Russia’s efforts"; these words suggest one step of removal from investigating the President himself. If the latter were the case, I suspect Comey wouldn't have used words suggestive of the Flynn-Manafort-Page cabal.

But that's reading a lot into a relatively small number of tea leaves. What is clear is that this was a very bad day for the President. In it, we learned that there is an open-ended Russia investigation with no timetable for completion, one that's going hang over Trump's head for a long time, and one to which the FBI director is entirely committed.

Comment →

State of the Discussion

bob
Ignored
Comments this threadCommenter Archive
+ Yeah, I read C's comments as trying to do a variety of things at the same time, having the effect of making interpretation more difficult. Any [. . .]
Benjamin Wittes: How to Read What Comey Said Today – Lawfare
bob
Ignored
Comments this threadCommenter Archive
+ Sure, so why do they have "work Phones" they take home? Even if they don't have fate of the world responsibilities, who they work [. . .]
Isenstadt and Vogel: Paranoia seizes Trump’s White House – POLITICO

Support This Site?