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

How do we get the URL of a tweet after using ExTwitter.update/1? #120

Open
mcade opened this issue Jan 23, 2020 · 1 comment
Open

How do we get the URL of a tweet after using ExTwitter.update/1? #120

mcade opened this issue Jan 23, 2020 · 1 comment

Comments

@mcade
Copy link

mcade commented Jan 23, 2020

I'm trying to get the URL of a tweet after tweeting an update with the ExTwitter.update/1 function. Looking at the twitter update status example, there is a URL to the tweet under the entities field.

But, doing ExTwitter.update("update sample") returns an ExTwitter.Model.Tweet with the entities field all empty:

#ExTwitter.Model.Entities<
  hashtags: [],
  media: [],
  polls: [],
  symbols: [],
  urls: [],
  user_mentions: [],
  ...
>

How am I supposed to get the URL of the tweet after using ExTwitter.update/1 if the entities fields are empty?

Right now I'm just appending the id_str field from the tweet to this url: https://twitter.com/i/web/status/{id_str} but not sure if this is conventional.

Disclaimer: I'm using {:poison, "~> 4.0", override: true} in mix.exs since ExTwitter is set to 3.0.

@mcade mcade changed the title ExTwitter.update/1 returns empty lists for entities field. How should we get the URL of a tweet after using ExTwitter.update/1? How do we get the URL of a tweet after using ExTwitter.update/1? Jan 23, 2020
@ashleyconnor
Copy link

The ExTwitter.Model.Entities.url is for links posted in a Tweet message, not for a URL to the tweet itself. Try tweeting with a URL inside the message and then the Entities model will be populated.

I think the only way to built the URL is the way you are suggesting.

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

2 participants