Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Noticed that the search query combo like "#hashtag from:username" doesn't work any longer. Seems that the twitter class php is still using the old http://search.twitter.com/search.json?q= and still using API 1 for username statuses and favorites feed. Upon checking the code I though it was as easy as replacing endpoints but seems that there has to be some tweaks with authentication as well which is connected to twitter drupal module. Will appreciate any help thanks guys!
Comment | File | Size | Author |
---|---|---|---|
#12 | 2624126-add-api-1_1-support-12.patch | 6.46 KB | rodrigoaguilera |
#11 | twitter_pull-add-api-1_1-support-2624126-11.patch | 6.83 KB | msherron |
#8 | twitter_pull-add-api-1_1-support-2624126-8.patch | 7.18 KB | msherron |
#2 | twitter_pull_2624126.patch | 433 bytes | sachin.bansal |
Comments
Comment #2
sachin.bansal CreditAttribution: sachin.bansal commentedHi,
Twitter pull module is compatible with Twitter module but authenticated account should be added on twitter module settings page from which tweets have to be fetched.
To fetch tweets of any account, please apply attached patch and then you just need to add one authenticated account on twitter settings page.
Thanks.
Comment #3
joachim CreditAttribution: joachim commentedI'm not sure how the patch relates to the issue summary...
Comment #4
kilowattz CreditAttribution: kilowattz commentedHi Sachin,
I do understand the setup between the Twitter and Twitter Pull module. My real concern is that the old twitter search API endpoint (which is being used in twitter pull module) has been deprecated and needs to be updated. I am having some difficulties understanding the new way of calling the search api. Hope this clears it up.
Comment #5
msherron CreditAttribution: msherron at Acquia commentedI've rolled a patch that uses the Twitter modules' auth_call function to make authenticated requests to the new API. I've also updated the endpoint paths to use the new 1.1 APIs. Since the old APIs are deprecated, I've collapsed get_items and twitter_get_items into one function.
Comment #6
msherron CreditAttribution: msherron at Acquia commentedComment #7
msherron CreditAttribution: msherron at Acquia commentedComment #8
msherron CreditAttribution: msherron at Acquia commentedUploading a new patch with format-patch git attrib info.
Comment #9
msherron CreditAttribution: msherron at Acquia commentedComment #10
joachim CreditAttribution: joachim commentedThanks for the patch!
It does need a little more work though:
... or in this case, less work!
Please resist the urge to clean up the typos. I know they're annoying and it's so easy to fix them on your way past, but it makes patches much harder to understand and review!
(I'll happily take a follow-up patch that cleans those up after this is in.)
What's the point of setting this as a variable? I presume it's an optional parameter to twitter_connect()?
I don't follow this change. Has there been a change to Twitter module's API, as well as the twitter.com's API?
Comment #11
msherron CreditAttribution: msherron at Acquia commentedOk, I've removed all typo fixes except for ones where I was directly adding new comments.
Yes. I'm modeling this work after Twitter modules' drush_twitter_search() since we're doing very similar work here in twitter_pull. The $force parameter is meant to load tweets to accounts that are not either global accounts (honestly not sure what that means) or that you've previously authenticated via OAuth. The new Twitter 1.1 API allows you to pull tweets from accounts other than yours, so long as you're authenticated with at least one active Twitter account.
I had previously set a variable because I thought in some cases setting $force to true wouldn't be necessary, but I found in my testing that it was always necessary. I've removed the variable (since it never changes) and just always send TRUE in the function call. Thanks for pointing that out.
Yes. The 1.1 API requires OAuth, and Twitter has deprecated non-authenticated requests to the old 1.0 endpoints. Also, all endpoints return data in json, thus the json_decode and subsequent data structure changes.
Comment #12
rodrigoaguileraSame patch as 11 but without the git info in the header so it can be applied with other tools other than git.