-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow search query to be passed in options hash
- Loading branch information
Showing
5 changed files
with
87 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Search | ||
|
||
You can get search results, up to 100 at a time. | ||
|
||
Here is an example of recursively geting pages of 100 Tweets until you receive | ||
an empty response. | ||
|
||
**Note: This may result in [rate limiting][].** | ||
|
||
[rate limiting]: https://github.com/sferik/twitter/blob/master/examples/RateLimiting.md | ||
|
||
```ruby | ||
require 'twitter' | ||
|
||
def get_all_results(options, collection = []) | ||
results = @client.search(options) | ||
collection += results.to_a | ||
results.next_results? ? get_all_results(results.next_results, collection) : collection | ||
end | ||
|
||
get_all_results(:q => "@sferik since:#{Date.today}", :count => 100) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters