The search_tweets() method in the Twitter class is currently incorrect. It is currently trying to search tweets by calling GET statuses/oembed, but the correct API call is GET search/tweets, as documented here:

https://dev.twitter.com/docs/api/1.1/get/search/tweets

Also, the Twitter class's get_statuses() method is incorrectly parsing the results of GET search/tweets.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sheldon Rampton’s picture

Status: Active » Needs review
FileSize
1.25 KB

Here's a patch that fixes this issue.

lukus’s picture

Works well for me. Thanks very much :)

juampynr’s picture

Version: 7.x-5.x-dev » 7.x-6.x-dev
Status: Needs review » Needs work

Please re-roll for 7.x-6.x.

Sheldon Rampton’s picture

Status: Needs work » Needs review
FileSize
1.26 KB

OK, here's a 7.x-6.x version.

@juampy, in the future, I'll plan on creating a 7.x-6.x version for any patches that I submit, which can then be backported as needed to 7.x-5.x and 6.x-5.x. However, I may first post a patch that corresponds to the module version where I first encounter a need to patch something.

juampynr’s picture

Status: Needs review » Needs work

Here are some comments from my review.

+++ b/twitter.lib.phpundefined
@@ -219,6 +219,27 @@ class Twitter {
   /**
+   * Get an array of TwitterStatus objects from an API endpoint

Please add docblocks as per Doxygen coding standards (http://drupal.org/node/1354). You can see examples in other functions of this file.

+++ b/twitter.lib.phpundefined
@@ -219,6 +219,27 @@ class Twitter {
+    if ($values && $values['statuses']) {

wrap array index checks with isset() to avoid warnings.

+++ b/twitter.lib.phpundefined
@@ -431,7 +452,7 @@ class Twitter {
+    return $this->get_search_results('search/tweets', $params);

If search is just to be done on search/tweets path within the Twitter API, we could remove this attribute and just use this path within get_search_results(), don't you think so?

Sheldon Rampton’s picture

Status: Needs work » Needs review
FileSize
1.46 KB

OK, here's an updated patch.

juampynr’s picture

Status: Needs review » Fixed

Committed. Thanks!

Just fixed a typo with the return array of get_search_resuls().

http://drupalcode.org/project/twitter.git/commit/718fd61

Feel free to reopen with a patch for 7.x-5.x.

Sheldon Rampton’s picture

Version: 7.x-6.x-dev » 7.x-5.x-dev
Status: Fixed » Needs review
FileSize
1.46 KB

OK, here's a backport of the patch for 7.x-5.x.

Sheldon Rampton’s picture

@juampy: Can you review and apply this patch? It's a straightforward backport of the version for 7.x-6.x, and it fixes a bug that I need fixed for my twitter_search module to work properly.

Sheldon Rampton’s picture

Status: Needs review » Reviewed & tested by the community

@juampy: Can you please take a look at this patch and commit it? I submitted it back in April, and I think it's very straightforward, so it should be easy for you to review and act on it.

Xano’s picture

Bump. I'd like to provide a patch for 6.x-5.x once this is fixed in 7.x-5.x.

Xano’s picture

FileSize
1.52 KB

This patch applies to 6.x-5.x and is a straight backport from the fix provided by Sheldon in #8. I confirmed that this works like a charm.

SebCorbin’s picture

Priority: Normal » Major

Bumping priority

SocialNicheGuru’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (fixed)

this is included in the feb dev version