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 video media type should be Media::Video #728

Closed
zhaohanweng opened this issue Sep 15, 2015 · 4 comments
Closed

twitter video media type should be Media::Video #728

zhaohanweng opened this issue Sep 15, 2015 · 4 comments

Comments

@zhaohanweng
Copy link
Contributor

using version 5.15,
after .search('#twittervideo') , the result should include twitter video media entities, but all the entities are only listed as Twitter::Media::Photo. and the the video urls is missing from the result as well.

client = ::Twitter::REST::Client.new do |config|
  config.consumer_key = TWITTER_APP_ID
  config.consumer_secret = TWITTER_APP_SECRET
  config.access_token = @account.access_token
  config.access_token_secret = @account.oauth_secret
end

result = client.search('#twittervideo')

>> result.map(&:id)
=> [643832695294853121, 643824390245875712, 643574858681610240, 642360099311329281, 642359812437733376, 642355369944203264, 642354437684641792, 642352678690004992, 642350989664776193, 642350540874219520, 642349955731091456, 642348735951962112, 642320879641337856, 642316526582939648, 642315613910642690, 641963831808258048, 641201100809465856, 641024351857303552]

>> result.map(&:media)
=> [[#<Twitter::Media::Photo id=643832573710327809>], [], [], [#<Twitter::Media::Photo id=642349901989416960>], [#<Twitter::Media::Photo id=642349901989416960>], [], [#<Twitter::Media::Photo id=642349901989416960>], [], [#<Twitter::Media::Photo id=642349901989416960>], [#<Twitter::Media::Photo id=642349901989416960>], [#<Twitter::Media::Photo id=642348024874663936>], [#<Twitter::Media::Photo id=642348024874663936>], [#<Twitter::Media::Photo id=642315613776424963>], [#<Twitter::Media::Photo id=642315613776424963>], [#<Twitter::Media::Photo id=642315613776424963>, #<Twitter::Media::Photo id=642315613776424963>], [], [#<Twitter::Media::Photo id=568932989976182784>], [#<Twitter::Media::Photo id=590032250567335936>]]

The actual tweets contain videos not photos.

But if I manually copy the same json from twitter, then create it with

Twitter::Tweet.new(json)

The result media entity is Twitter::Media::Video

@stve
Copy link
Collaborator

stve commented Sep 15, 2015

hi @zhaohanweng can you log a few tweet ids that I can use to try to reproduce this? Thanks.

@zhaohanweng
Copy link
Contributor Author

hi @stve here's a list of twitter ids

[643832695294853121, 643824390245875712, 643574858681610240, 642360099311329281, 642359812437733376, 642355369944203264, 642354437684641792, 642352678690004992, 642350989664776193, 642350540874219520, 642349955731091456, 642348735951962112, 642320879641337856, 642316526582939648, 642315613910642690, 641963831808258048, 641201100809465856, 641024351857303552]

This result is from client.search('#twittervideo')

@stve
Copy link
Collaborator

stve commented Oct 15, 2015

hi @zhaohanweng, I finally had a chance to take a look at this. It looks like the search endpoint does not include extended_entities in tweet response which is what are used to obtain video information from the response.

Notice the differences between the two JSON objects in this gist. The individual tweet (using one of the ID's above) contains a lot more entity information, than the tweet that was obtained via client.search('#twittervideo'). I also got the same result using client.search('#twittervideo', include_entities: true).

I think your best bet would be to take the tweet ID's from search and then use Twitter::REST::Tweets#status to obtain the entity data.

@stve stve closed this as completed Oct 15, 2015
@zhaohanweng
Copy link
Contributor Author

thanks so much for looking into this. Seems twitter have the inconsistency for a while now. I will have to do tweets lookups for now.

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