magalbraith / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

Patch: Twitter Search API Support #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Find a patch file attached to add support for searching Twitter via the 
API. See the following link:

http://apiwiki.twitter.com/Twitter-Search-API-Method:-search

To search:
GetSearch(term[, since_id=None, per_page=15, page=1, lang="en"])

Also a simple function to filter the public timeline results by a keyword 
(locally):
FilterPublicTimeline(term[, since_id=None])

Let me know if anything needs to be changed/added for this to be accepted.

Thanks,
Gavin H.

Original issue reported on code.google.com by ghi...@gmail.com on 13 May 2009 at 11:34

Attachments:

GoogleCodeExporter commented 9 years ago
I am looking forward to seeing Twitter Search API gets into python-twitter.

The patch works good. But it may run out of request quota very soon. The search
doesn't consume any quota, but there is a user search in the new method 
`GetSearch`,
per_page=15, then 15 quota used. Currently quota is 100, only took 7 queries to 
run
out, even with since_id, probably few more queries.

My patch includes two parameter. One is to switch user query, another is for
`show_user`, it was fixed in ghills' patch.

Also, I think the method name should be `Search`, or `GetSearchResults`.

Original comment by livibet...@gmail.com on 27 May 2009 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
the assignment of parameters['q'] in the patch I uploaded, should be 
parameters['q']
= term

Original comment by livibet...@gmail.com on 27 May 2009 at 1:02

GoogleCodeExporter commented 9 years ago
Attached is the above mentioned patch,
with the additional support for geocode in search Api.
This is reflect both in the addition of a parameter
to GetSearch called geocode which should take the form
of a python tuple (latitude, longitude, radius_str), e.g:
 (37.775,-122.41833,'25km')
as well as the relevant 'location' property and getter/setter methods
for the Status object

-Chak

Original comment by JimMoe...@gmail.com on 31 May 2009 at 8:59

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

trying to run it like

import sys
import twitter
tapi = twitter.Api()
searchresult = tapi.GetSearch("Projektmanagement")
print [s.id for s in searchresult]

.. and I do not get the latest tweets in my result. Any clue why?

Thanks!

Thomas

Original comment by cyberbra...@gmail.com on 4 Jun 2009 at 6:13

GoogleCodeExporter commented 9 years ago
Hi, Thomas

Sometimes Twitter has delay results (could be hours delay) from search, you can 
check
by searching on http://search.twitter.com/

Or manually get this http://search.twitter.com/search.json?q=Projektmanagement
to see if it is delayed.

Original comment by livibet...@gmail.com on 5 Jun 2009 at 1:38

GoogleCodeExporter commented 9 years ago
Wow -the manual result http://search.twitter.com/search.json?q=Projektmanagement
works as expected and does not match

import sys
import twitter
tapi = twitter.Api()
searchresult = tapi.GetSearch("Projektmanagement")
print [s.id for s in searchresult]

where I get very old results.

Is it me?

TIA,

Thomas 

Original comment by cyberbra...@gmail.com on 5 Jun 2009 at 3:44

GoogleCodeExporter commented 9 years ago
bloody me - it's the language setting.

...
searchresult = tapi.GetSearch("Projektmanagement", lang="de")
...

does the trick ;-)

Original comment by cyberbra...@gmail.com on 5 Jun 2009 at 3:50

GoogleCodeExporter commented 9 years ago
Are there any outstanding issues blocking this from being merged into trunk? I 
could
use this functionality, but rather than roll my own I'd prefer to help out if 
there's
work to be done :)

Original comment by darren.w...@gmail.com on 28 Aug 2009 at 4:22

GoogleCodeExporter commented 9 years ago
Is this patch against trunk, or against the branches/dclinton branch?  I try to 
keep the 
functionality between the two in sync, but honestly I'd rather cut the trunk 
over to the 
dclinton branch and just invest in that one.  But I haven't heard enough 
feedback from 
people one way or the other to make a determination yet.  Thoughts?

Original comment by dclinton on 28 Aug 2009 at 4:46

GoogleCodeExporter commented 9 years ago
Hello..

This patches aren't ignoring properties from twitter search api like next_page,
completed_in and refresh_url?

I've coded search support myself and I created a SearchResult class. This class 
has a
list of results (Status object) and this 3 properties.

Original comment by felipec-...@hotmail.com on 29 Aug 2009 at 6:05

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I was wondering why there is such a delay with the out of the search. Is it a
limitation they put on the API for developers. When I search for terms it takes 
in
statuses from an hour ago, while the search on twiiter returns completely 
different
status which are more recent. Please any help or edits we can do to the current 
code
I would be more than willing to code, just point me in the right direction. 
Here is
the code I have now.

Original comment by yusuf.mahdi@gmail.com on 3 Dec 2009 at 4:42

Attachments:

GoogleCodeExporter commented 9 years ago
Is the search functionality merged into the main code now ??
Or we should download the patch ???
Any clue ?

Original comment by Abli...@gmail.com on 4 Jan 2010 at 6:35

GoogleCodeExporter commented 9 years ago
i have applied patch2. 

I am trying to get results for queries in which users have put in an emoticon - 
:) 
for e.g. - "avatar :)"
for e.g. - "avatar :("

searchresult = api.GetSearch('avatar :\)')

this however results in no results being returned. any ideas ? 

Original comment by sweetshe...@yahoo.co.in on 9 Jan 2010 at 11:59

GoogleCodeExporter commented 9 years ago
patch(es) applied to revision 
http://code.google.com/p/python-twitter/source/detail?
r=1dc9d55ac4061405195093e0128c407d8b41dc4e

Original comment by bear42 on 24 Jan 2010 at 9:53