Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter Tweet Title, Description and Media stopped working. #364

Closed
Grienauer opened this issue Jun 5, 2020 · 6 comments
Closed

Twitter Tweet Title, Description and Media stopped working. #364

Grienauer opened this issue Jun 5, 2020 · 6 comments

Comments

@Grienauer
Copy link

Problem:
Due to Changes on Twitter, currently the Title, Description and Image is not available any more.

Solution for Description:
We could use parts of the Embed Code/Output.

Demo:
https://oscarotero.com/embed/demo/index.php?url=https%3A%2F%2Ftwitter.com%2Fdrupalassoc%2Fstatus%2F1217450156523692038

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Drupal 1.0.0, was released today in 2001! Happy birthday Drupal! <a href="https://twitter.com/hashtag/DrupalBirthday?src=hash&amp;ref_src=twsrc%5Etfw">#DrupalBirthday</a> <a href="https://t.co/B5L4CrZyDL">pic.twitter.com/B5L4CrZyDL</a></p>&mdash; Drupal Association (@drupalassoc) <a href="https://twitter.com/drupalassoc/status/1217450156523692038?ref_src=twsrc%5Etfw">January 15, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
--

We could use the content between the <blockquote> tag and remove all html tags.
then we would get (at least for this sample):
"Drupal 1.0.0, was released today in 2001! Happy birthday Drupal! #DrupalBirthday — Drupal Association (@drupalassoc) January 15, 2020"
Would be great to also remove the Name/Date part if we find a solution for this.

Maybe this could be a quick workaround for the current Tweet implementation?

Bonus: Extract the hashtag from the element and add it to the keywords field :)

@oscarotero
Copy link
Owner

I think twitter always work as is, but we can create an adapter for Twitter. Do you want to work on a pull request?

If so, take the Facebook adapter as a reference, that has a custom title detector: https://github.com/oscarotero/Embed/tree/master/src/Adapters/Facebook

@patriksh
Copy link
Contributor

patriksh commented Jan 3, 2022

Any updates on this?
I'm not sure how I'd handle this with a detector, as Twitter renders stuff on clientside with Javascript. Twitter API could be used perhaps.

@oscarotero
Copy link
Owner

No updates yet.
I think the most easy way is get the content from the bloquote tag of the embed code and remove the HTML tags.

Twitter API is good too, but I'm not familiarized with it and not sure if it requires a token.

@patriksh
Copy link
Contributor

patriksh commented Jan 3, 2022

Too bad that blockquote doesn't even contain an image link...
They do need an API key for their API. You think it'd be worth making a PR for this using the API? I'll probably have to do it anyways for one of my clients.
I might need some guidelines on how to structure it properly tho.

@oscarotero
Copy link
Owner

Yes, sure!.
You can see other examples of adapters using APIs like Archive, ImageShack or Wikipedia.

@oscarotero
Copy link
Owner

fixed in 4.4.0

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

No branches or pull requests

3 participants