twitter.cursor(twitter.search, since_id='some id', q='your_query') return duplicated results #325
Labels
No labels
Bug
Enhancement
Feature Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: code/twython#325
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
for result in twitter.cursor(twitter.search,q = "embomolmed.embopress.org",since_id='467233427826434048',result_type="mixed",count=100):
count += 1
print "----------------------"
print count
print result["id"]
print result["created_at"]
print result["text"]
if count % 100 == 0:
print count
The code display the tweet 468418418199494656 and 467233427826434048 endlessly.
However, the same code for the tweepy works, only one 468418418199494656 was displayed.
Take a look if this solves your problem: https://github.com/ryanmcgrath/twython/pull/332
I've had the same problem with
twitter.cursor(twitter.search, return_pages=True, **params)returning the same page of results with each loop of the cursor.I found that in twython/api.py for the cursor function, the "max_id" parameter is not being set--rather, the "since_id" parameter alone is being set, which does not allow the cursor to retrieve earlier pages.
I modified the
hasattr(function, 'iter_metadata')if clause with the following (api.py line 502 +):Note that the part of the block which affects twitter.search is when
hasattr(...)evaluates toTrue--so I didn't modify the content of the else clause as that might be correct for non-search functions(?).In addition I removed the
if 'max_id' not in params:(api.py line 499) clause, so that the max_id parameter could be set as above--otherwise the generator would skip this after the secondyield. This is a kludge since I don't create the cursor with the "max_id" parameter in "params"--indeed the Twitter dev docs recommend that for the first page return, only the 'count' param should be passed. But a full patch would naturally test for the max_id param being passed by the user totwitter.cursor.Also running into this issue.
I had the same problem, and tracked it down to the usage of
since_idinstead ofmax_idin thecursormethod, as @jam1123 described. I didn't want to deal with trying to fix the cursor method, so I'm just paginating manually using thesearchmethod and passingmax_idas a parameter.Ran into the same problem (using
since_id)