add option to get tweets from one user
This commit is contained in:
parent
3bf45b9d33
commit
3cc5659310
1 changed files with 5 additions and 3 deletions
|
@ -8,9 +8,11 @@ import lxml.html
|
|||
import ox
|
||||
from ox.cache import read_url
|
||||
|
||||
|
||||
def find(query, timeout=60):
|
||||
url = 'https://twitter.com/search/' + quote(query)
|
||||
def find(query=None, user=None, timeout=60):
|
||||
if user:
|
||||
url = 'https://twitter.com/' + quote(user)
|
||||
else:
|
||||
url = 'https://twitter.com/search/' + quote(query)
|
||||
data = ox.cache.read_url(url, timeout=timeout).decode('utf-8')
|
||||
doc = lxml.html.document_fromstring(data)
|
||||
tweets = []
|
||||
|
|
Loading…
Reference in a new issue