ckoepp / twittersearch Goto Github PK
View Code? Open in Web Editor NEWA Python library to easily iterate tweets found by the Twitter Search API
License: MIT License
A Python library to easily iterate tweets found by the Twitter Search API
License: MIT License
TwitterSearch
is great, but do you plan to provide a more PEP-8
-ish API?
For instance, here's an example from the README:
from twitter_search import *
tso = TwitterSearchOrder() # create a TwitterSearchOrder object
tso.set_kewords(['Guttenberg', 'Doktorarbeit'])
tso.set_language('de')
tso.set_count(7)
tso.set_include_intities(False)
try:
ts = TwitterSearch(
consumer_key = 'aaabbb',
consumer_secret = 'cccddd',
access_token = '111222',
access_token_secret = '333444'
)
for tweet in ts.iter_search(tso):
# ...
except TwitterSearchException as e:
print(e)
Because of National Great Firewall ,i could not get the response,so how can i use a proxy ip ?
Implement a new class to generate complex queries using the current available Query operators.
The line
102: if isinstance(date, date):
should be
102: if isinstance(date, datetime.date):
I'm too lazy to fork and request a pull :-)
Implement an interface to call a user-defined method when new queries are sent to the Twitter API
Is there anyway to search for a list of emoji? I am trying to search for all the flag emoji, but I get the error Error 403: ('Forbidden: The request is understood, but', 'it has been refused or access is not allowed')
main.py
import flags
from TwitterSearch import *
import sys
import json
def is_flag_emoji(c):
return "\U0001F1E6\U0001F1E8" <= c <= "\U0001F1FF\U0001F1FC" or c in ["\U0001F3F4\U000e0067\U000e0062\U000e0065\U000e006e\U000e0067\U000e007f", "\U0001F3F4\U000e0067\U000e0062\U000e0073\U000e0063\U000e0074\U000e007f", "\U0001F3F4\U000e0067\U000e0062\U000e0077\U000e006c\U000e0073\U000e007f"]
i = 0
data = {}
try:
tso = TwitterSearchOrder() # create a TwitterSearchOrder object
tso.set_keywords(flags.list) # let's define all words we would like to have a look for
tso.set_language('en') # we want to see German tweets only
tso.set_include_entities(False) # and don't give us all those entity information
tso.set_count(20)
# it's about time to create a TwitterSearch object with our secret tokens
ts = TwitterSearch(
consumer_key = '****',
consumer_secret = '****',
access_token = '****',
access_token_secret = '****'
)
# this is where the fun actually starts :)
for tweet in ts.search_tweets_iterable(tso):
if i <= 20:
# print( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) )
data[tweet['user']['screen_name']] = tweet['text']
i += 1
else:
print(data)
sys.exit(1)
except TwitterSearchException as e: # take care of all those ugly errors if there are some
print(e)
flags.py
list = ["๐ฆ๐ซ", "๐ฆ๐ฝ", "๐ฆ๐ฑ", "๐ฉ๐ฟ", "๐ฆ๐ธ", "๐ฆ๐ฉ", "๐ฆ๐ด", "๐ฆ๐ฎ", "๐ฆ๐ถ", "๐ฆ๐ฌ", "๐ฆ๐ท", "๐ฆ๐ฒ", "๐ฆ๐ผ", "๐ฆ๐จ", "๐ฆ๐บ", "๐ฆ๐น", "๐ฆ๐ฟ", "๐ง๐ธ", "๐ง๐ญ", "๐ง๐ฉ", "๐ง๐ง", "๐ง๐พ", "๐ง๐ช", "๐ง๐ฟ", "๐ง๐ฏ", "๐ง๐ฒ", "๐ง๐น", "๐ง๐ด", "๐ง๐ฆ", "๐ง๐ผ", "๐ง๐ป", "๐ง๐ท", "๐ฎ๐ด", "๐ป๐ฌ", "๐ง๐ณ", "๐ง๐ฌ", "๐ง๐ซ", "๐ง๐ฎ", "๐ฐ๐ญ", "๐จ๐ฒ", "๐จ๐ฆ", "๐ฎ๐จ", "๐จ๐ป", "๐ง๐ถ", "๐ฐ๐พ", "๐จ๐ซ", "๐ช๐ฆ", "๐น๐ฉ", "๐จ๐ฑ", "๐จ๐ณ", "๐จ๐ฝ", "๐จ๐ต", "๐จ๐จ", "๐จ๐ด", "๐ฐ๐ฒ", "๐จ๐ฌ", "๐จ๐ฉ", "๐จ๐ฐ", "๐จ๐ท", "๐จ๐ฎ", "๐ญ๐ท", "๐จ๐บ", "๐จ๐ผ", "๐จ๐พ", "๐จ๐ฟ", "๐ฉ๐ฐ", "๐ฉ๐ฌ", "๐ฉ๐ฏ", "๐ฉ๐ฒ", "๐ฉ๐ด", "๐ช๐จ", "๐ช๐ฌ", "๐ธ๐ป", "๐ฌ๐ถ", "๐ช๐ท", "๐ช๐ช", "๐ช๐น", "๐ช๐บ", "๐ซ๐ฐ", "๐ซ๐ด", "๐ซ๐ฏ", "๐ซ๐ฎ", "๐ซ๐ท", "๐ฌ๐ซ", "๐ต๐ซ", "๐น๐ซ", "๐ฌ๐ฆ", "๐ฌ๐ฒ", "๐ฌ๐ช", "๐ฉ๐ช", "๐ฌ๐ญ", "๐ฌ๐ฎ", "๐ฌ๐ท", "๐ฌ๐ฑ", "๐ฌ๐ฉ", "๐ฌ๐ต", "๐ฌ๐บ", "๐ฌ๐น", "๐ฌ๐ฌ", "๐ฌ๐ณ", "๐ฌ๐ผ", "๐ฌ๐พ", "๐ญ๐น", "๐ญ๐ฒ", "๐ญ๐ณ", "๐ญ๐ฐ", "๐ญ๐บ", "๐ฎ๐ธ", "๐ฎ๐ณ", "๐ฎ๐ฉ", "๐ฎ๐ท", "๐ฎ๐ถ", "๐ฎ๐ช", "๐ฎ๐ฒ", "๐ฎ๐ฑ", "๐ฎ๐น", "๐ฏ๐ฒ", "๐ฏ๐ต", "๐ฏ๐ช", "๐ฏ๐ด", "๐ฐ๐ฟ", "๐ฐ๐ช", "๐ฐ๐ฎ", "๐ฝ๐ฐ", "๐ฐ๐ผ", "๐ฐ๐ฌ", "๐ฑ๐ฆ", "๐ฑ๐ป", "๐ฑ๐ง", "๐ฑ๐ธ", "๐ฑ๐ท", "๐ฑ๐พ", "๐ฑ๐ฎ", "๐ฑ๐น", "๐ฑ๐บ", "๐ฒ๐ด", "๐ฒ๐ฐ", "๐ฒ๐ฌ", "๐ฒ๐ผ", "๐ฒ๐พ", "๐ฒ๐ป", "๐ฒ๐ฑ", "๐ฒ๐น", "๐ฒ๐ญ", "๐ฒ๐ถ", "๐ฒ๐ท", "๐ฒ๐บ", "๐พ๐น", "๐ฒ๐ฝ", "๐ซ๐ฒ", "๐ฒ๐ฉ", "๐ฒ๐จ", "๐ฒ๐ณ", "๐ฒ๐ช", "๐ฒ๐ธ", "๐ฒ๐ฆ", "๐ฒ๐ฟ", "๐ฒ๐ฒ", "๐ณ๐ฆ", "๐ณ๐ท", "๐ณ๐ต", "๐ณ๐ฑ", "๐ณ๐จ", "๐ณ๐ฟ", "๐ณ๐ฎ", "๐ณ๐ช", "๐ณ๐ฌ", "๐ณ๐บ", "๐ณ๐ซ", "๐ฒ๐ต", "๐ฐ๐ต", "๐ณ๐ด", "๐ด๐ฒ", "๐ต๐ฐ", "๐ต๐ผ", "๐ต๐ธ", "๐ต๐ฆ", "๐ต๐ฌ", "๐ต๐พ", "๐ต๐ช", "๐ต๐ญ", "๐ต๐ณ", "๐ต๐ฑ", "๐ต๐น", "๐ต๐ท", "๐ถ๐ฆ", "๐ท๐ช", "๐ท๐ด", "๐ท๐บ", "๐ท๐ผ", "๐ผ๐ธ", "๐ธ๐ฒ", "๐ธ๐น", "๐ธ๐ฆ", "๐ธ๐ณ", "๐ท๐ธ", "๐ธ๐จ", "๐ธ๐ฑ", "๐ธ๐ฌ", "๐ธ๐ฝ", "๐ธ๐ฐ", "๐ธ๐ฎ", "๐ธ๐ง", "๐ธ๐ด", "๐ฟ๐ฆ", "๐ฌ๐ธ", "๐ฐ๐ท", "๐ธ๐ธ", "๐ช๐ธ", "๐ฑ๐ฐ", "๐ง๐ฑ", "๐ธ๐ญ", "๐ฐ๐ณ", "๐ฑ๐จ", "๐ฒ๐ซ", "๐ต๐ฒ", "๐ป๐จ", "๐ธ๐ฉ", "๐ธ๐ท", "๐ธ๐ฏ", "๐ธ๐ฟ", "๐ธ๐ช", "๐จ๐ญ", "๐ธ๐พ", "๐น๐ผ", "๐น๐ฏ", "๐น๐ฟ", "๐น๐ญ", "๐น๐ฑ", "๐น๐ฌ", "๐น๐ฐ", "๐น๐ด", "๐น๐น", "๐น๐ฆ", "๐น๐ณ", "๐น๐ท", "๐น๐ฒ", "๐น๐จ", "๐น๐ป", "๐บ๐ฌ", "๐บ๐ฆ", "๐ฆ๐ช", "๐ฌ๐ง", "๐ด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ", "๐ด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ", "๐ด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ", "๐บ๐ธ", "๐บ๐พ", "๐บ๐ฒ", "๐ป๐ฎ", "๐บ๐ฟ", "๐ป๐บ", "๐ป๐ฆ", "๐ป๐ช", "๐ป๐ณ", "๐ผ๐ซ", "๐ช๐ญ", "๐พ๐ช", "๐ฟ๐ฒ", "๐ฟ๐ผ"]
Not sure if this is an error on my end, or something I don't understand.
Background:
I'm using a Ukrainian word list to mine tweets from twitter for research. I have it saved as a cPickle file which I upload and able to print into python without any problems.
Problem:
I receive the following error and can't figure out what is going on to is throwing it. Any help would be appreciated.
Traceback (most recent call last):
File "<pyshell#29>", line 1, in <module>
execfile("twittersearchloc.py")
File "twittersearchloc.py", line 25, in <module>
for tweet in ts.search_tweets_iterable(tso):
File "C:\Python27\lib\site-packages\twittersearch-1.0.1-py2.7.egg\TwitterSearch\TwitterSearch.py", line 204, in search_tweets_iterable
self.search_tweets(order)
File "C:\Python27\lib\site-packages\twittersearch-1.0.1-py2.7.egg\TwitterSearch\TwitterSearch.py", line 305, in search_tweets
self._start_url = order.create_search_url()
File "C:\Python27\lib\site-packages\twittersearch-1.0.1-py2.7.egg\TwitterSearch\TwitterSearchOrder.py", line 232, in create_search_url
url += '+'.join([quote_plus(i) for i in self.searchterms])
File "C:\Python27\lib\urllib.py", line 1310, in quote_plus
return quote(s, safe)
File "C:\Python27\lib\urllib.py", line 1303, in quote
return ''.join(map(quoter, s))
KeyError: u'\ufeff'
How I tried to solve the problem:
I figured the non ascii formart was throwing it off, but trying to decode or encode it into different formats didn't work.
Hello,
Is it possible to get request usage ?
I mean the maximum number of requests that can be done using the given credentials together with the number of requests already done.
Thank you
Regards
Hello... I'm using your library and I don't know why but my program randomly freezes sometimes. My program is pretty simple and is pretty much just copying the code sample you provide @https://twittersearch.readthedocs.org/en/latest/index.html (actually, your code sample was also freezing when I tried it).
Could it have to do with the version of python I'm using? (2.7.9)
I installed TwitterSearch through pip. I hope its not some deadlock issue.
Here's what I've been running:
from TwitterSearch import *
from time import sleep
try:
tso = TwitterSearchOrder() # create a TwitterSearchOrder object
tso.set_keywords(['#vr', '-RT']) # let's define all words we would like to have a look for
tso.set_language('en') # hell no German, I want English!
tso.set_include_entities(False) # and don't give us all those entity information
# it's about time to create a TwitterSearch object with our secret tokens
ts = TwitterSearch(
consumer_key = 'xxxx',
consumer_secret = 'xxxx',
access_token = 'xxxx',
access_token_secret = 'xxxx'
)
# open file for writing
text_file = open("#vrtest.txt", "w")
# check when to stop
iterations = 0
max_tweets = 100000
# callback fucntion used to check if we need to pause the program
def my_callback_closure(current_ts_instance): # accepts ONE argument: an instance of TwitterSearch
queries, tweets_seen = current_ts_instance.get_statistics()
if queries > 0 and (queries % 2) == 0: # trigger delay every other query
print("\nQueries: " + str(queries) + " now sleeping, 1 minute.\n");
sleep(60) # sleep for 60 seconds
# this is where the fun actually starts :)
for tweet in ts.search_tweets_iterable(tso, callback=my_callback_closure):
current_line = "%s" % ( tweet['text'] )
iterations = iterations + 1
print( "i: " + str(iterations) + " - " + tweet['user']['screen_name'] + " tweeted: " + current_line )
text_file.write(current_line.encode('utf-8', 'ignore') + "\n")
# wait 1 second every 10 tweets
if (iterations % 10 == 0):
print("\nSleeping 1 second.\n")
sleep(1)
if (iterations >= max_tweets):
break
except TwitterSearchException as e: # take care of all those ugly errors if there are some
print(e)
finally:
# close file
text_file.close()
I am trying to constrain the area I search for tweets in the UK, but am receiving an error response from the TwitterSearchOrder.py module.
[code]C:\Users\cjadmin>C:\Users\cjadmin\Desktop\py\search.py
Traceback (most recent call last):
File "C:\Users\cjadmin\Desktop\py\search.py", line 26, in
tso.setGeocode(53.409144,-2.147483,10,'mi') # Set location constraints with
geocode
File "C:\Python27\lib\site-packages\twittersearch-0.78.3-py2.7.egg\TwitterSear
ch\TwitterSearchOrder.py", line 138, in setGeocode
raise TwitterSearchException(1005)
TwitterSearch.TwitterSearchException.TwitterSearchException: Error 1005: Invalid
unit.[/code]
I've tried escaping the minus for the geocode but that also fails.
Are UK codes unsupported?
Hi, I am new to this. I have been able to get a script going using TwitterSearch by passing in a keyword or two, but can I mimic the near me function of the actual twitter search (more) options?
I tried different variations like this:
tso.set_keywords([], or_operator = True) # let's define all words we would like to have a look for tso.set_geocode(138.599,-34.93,10,imperial_metric=True)
Any help would be appreciated.
Hello,
I am a PhD student. I am new to python and using TwitterSearch to collect tweets from 03-20 Aug for a particular location (geocode). I am trying to run the following piece of code.
try:
tso = TwitterSearchOrder()
tso.set_keywords(['protest','protested','protesting','riot','rioted',
'rioting',
'rally',
'rallied',
'rallying',
'marched',
'marching',
'strike',
'striked',
'striking'])
tso.set_language('en') # we want to see German tweets only
tso.set_geocode (37.00,-92.00,100)
tso.set_include_entities(False) # and don't give us all those entity information
tso.set_since_id (367020906049835008)
tso.set_max_id (501488707195924481)
ts = TwitterSearch(
consumer_key = '.............', # my access credentials
consumer_secret = '.........................',
access_token = '...................',
access_token_secret = '.......................'
)
for tweet in ts.search_tweets_iterable(tso):
user=tweet['user']['screen_name'].encode("ASCII", errors='ignore')
text=tweet['text'].encode("ASCII", errors='ignore')
time=tweet['created_at'].encode("ASCII", errors='ignore')
print ( '@%s tweeted: %s on %s' % ( user, text, time ) + '\n')
except TwitterSearchException as e:
print(e)
However, above piece of code is not returning anything. Please help me in this regard. Can I collect old tweets without any keyword for a particular location?
Thanks in advance.
Regards,
Mohammed
Add methods to TwitterSearchOrder
for excluding retweets and replies.
There is currently a work-around for this:
tso.set_keywords(['yourKeywordHere', '-filter:retweets', '-filter:replies'])
Would there be any way to turn this easily into AIOHTTP instead of requests?
Hi, any way to set tweet_mode to extended so I can access non-truncated tweets? Thanks.
Not every ISO 639-1 locale code is actually supported.
However, there is a possibility to load all supported codes from Twitter which could be implemented to check if Twitter even supports an language code used as argument within a certain query.
Hey,
Does this library support retrieving tweets from statuses/home_timeline ?
Thanks
Hello,
It is possible to know if the post (tweet) is a reply, retweet or quote from another tweet?
Thanks.
Some test-cases are failing on python3k.
Line 115 of TwitterSearch:
self.__nextMaxID = min(self.__response['content']['statuses'], key=lambda i: i['id'])['id'] - 1
Since I've only just started looking at this I'm essentially following your getting started guide in the README for a keyword search I'm looking at (single search term: 'ECAWA'), and this line is throwing a value error since the argument to min() is an empty sequence.
Seem to be having a problem with your Python Lib
Traceback (most recent call last):
File "main.py", line 41, in
for tweet in ts.searchTweetsIterable(tso): # this is where the fun actually starts :)
File "/usr/local/lib/python2.7/dist-packages/TwitterSearch-0.1-py2.7.egg/TwitterSearch/TwitterSearch.py", line 32, in searchTweetsIte
rable
self.searchTweets(order)
File "/usr/local/lib/python2.7/dist-packages/TwitterSearch-0.1-py2.7.egg/TwitterSearch/TwitterSearch.py", line 50, in searchTweets
self.sentSearch(order.createSearchURL())
File "/usr/local/lib/python2.7/dist-packages/TwitterSearch-0.1-py2.7.egg/TwitterSearch/TwitterSearch.py", line 40, in sentSearch
if self.response['content']['search_metadata'].get('next_results'):
KeyError: 'search_metadata'
Is the error I'm getting using the sample code on your read me (seen below):
from TwitterSearch import *
tso = TwitterSearchOrder() # create a TwitterSearchOrder object
tso.setKeywords(['hullcompsci']) # can include multipul searches (e.g. for when GGJ or TTG is on) tso.setKeywords(['Guttenberg', 'Doktorarbeit'])
tso.setCount(100) # please dear Mr Twitter, give us 100 results per page (this is the default value, I know :P)
tso.setLanguage('en')
tso.setIncludeEntities(False) # and don't give us all those entity information (this is a default value too)
ts = TwitterSearch(
consumer_key = 'censored'
consumer_secret = 'censored',
access_token = 'censored',
access_token_secret = 'censored'
)
ts.authenticate()
counter = 0 # just a small counter
for tweet in ts.searchTweetsIterable(tso): # this is where the fun actually starts :)
counter += 1
print '@%s tweeted: %s' % (tweet['user']['screen_name'], tweet['text'])
print '*** Found a total of %i tweets' % counter
Thanks
Thanks for this library. Working very well.
This is more of a question on the twitter api I guess, but maybe you've encountered this before.
Every now and again, I find that the search (iterating using searchTweetsIterable) stops because in the twitter response, the search_metadata.next_results item is completely missing. Do you know of a good reason why this is happening? I don't see anything about this in the API documentation. It is also not due to rate limitation.
If I manually run another search with my own max_id populated, I get another set of results, again with the search_metadata.next_results missing.
Hi, me again. Maybe I really should fork and pull. If I find another bug I will :)
70: self.argument.update( { 'since_id' : '%s' % twid } )
should be
70: self.arguments.update( { 'since_id' : '%s' % twid } )
The same for line 76
76: self.argument.update( { 'max_id' : '%s' % twid } )
should be
76: self.arguments.update( { 'max_id' : '%s' % twid } )
Next time I will fork, promise.
The method set_include_entities()
was misspelt as set_include_etities
3 times in
https://github.com/ckoepp/TwitterSearch/blob/master/docs/advanced_usage_tso.rst
Implement App-only auth with OAuth2.
While using your lib, I've run into the issue that ValueError is thrown if certain characters such as '(', ')', '[', ']', '$', '?', "'" (apostrophe) and TwitterSearch.TwitterSearchException.TwitterSearchException: Error 401: Unauthorized is produced when I use 'test=', 'test=foo' (basically anytime when I use '=' character). Code producing the aforementioned exceptions (CONSUMER_KEY, CONSUMER_SECRET, TOKEN_KEY, TOKEN_SECRET are keys specific to my application and are working):
Python 2.7.5, TwitterSearch 0.78.3
import logging
import traceback
import TwitterSearch
def download_tweets(search_string, language):
"""Returns list of tweets containing <search_string>, should be like 'en' or 'ru' """
tso = TwitterSearch.TwitterSearchOrder()
tso.addKeyword(search_string)
tso.setLanguage(language)
tso.setIncludeEntities(False)
# create a TwitterSearch object with our secret tokens
ts = TwitterSearch.TwitterSearch(
consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
access_token=TOKEN_KEY,
access_token_secret=TOKEN_SECRET
)
try:
return ts.searchTweetsIterable(tso)
except TwitterSearch.TwitterSearchException as e:
logging.exception("%s: %s", e.code, e.message)
logging.exception("Stack trace: %s", traceback.format_exc())
raise e
download_tweets("test=", "en")
download_tweets("test=foo", "en")
download_tweets("test'", "en")
download_tweets("test$", "en")
download_tweets("test?", "en")
download_tweets("test(", "en")
download_tweets("test)", "en")
download_tweets("test[", "en")
download_tweets("test]", "en")
I would like to make a query using a geocode argument only. Just give it coordinates, radius, and date range, and have it pull up all tweets in the area. When I try this however, I get the "No Keywords Given" error. Is it possible to make a query with no Keywords in this library?
I am having a problem installing TwitterSearch using Python 3.4 on Windows 7. "pip install TwitterSearch" returns a codec error:
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 3826: character maps to <undefined>
My full pip.log can be found here: https://gist.github.com/codedthiscode/a662f8223936e48a645d.
I also tried using easy_install but I am getting the same error. A fair amount of Googling has not solved the problem. Any advice?
tso.set_count(5)
is not working on my side:
try:
tso = TwitterSearchOrder()
tso.set_keywords(['Lucca'])
tso.set_count(5)
tso.set_result_type('recent')
# tso.set_until(datetime.date(2016, 04, 27))
# tso.set_until(datetime.date(datetime.now()))
ts = TwitterSearch(
consumer_key = 'xxx',
consumer_secret = 'xxx',
access_token = 'xxxx,
access_token_secret = 'xxxx'
)
for tweet in ts.search_tweets_iterable(tso):
print tweet['entities']['media'][0]['media_url_https']
except TwitterSearchException as e: # take care of all those ugly errors if there are some
print(e)
it's reporting hundred of results.
I am trying to constrain the area I search for tweets in the UK, but am receiving an error response from the TwitterSearchOrder.py module.
[code]C:\Users\cjadmin>C:\Users\cjadmin\Desktop\py\search.py
Traceback (most recent call last):
File "C:\Users\cjadmin\Desktop\py\search.py", line 26, in
tso.setGeocode(53.409144,-2.147483,10,'mi') # Set location constraints with
geocode
File "C:\Python27\lib\site-packages\twittersearch-0.78.3-py2.7.egg\TwitterSear
ch\TwitterSearchOrder.py", line 138, in setGeocode
raise TwitterSearchException(1005)
TwitterSearch.TwitterSearchException.TwitterSearchException: Error 1005: Invalid
unit.[/code]
I've tried escaping the minus for the geocode but that also fails.
Are UK codes unsupported?
Hello, I am having troubles using query operators. For example the query '"michelle bachelet"' throws tweets including not only "michelle bachelet" exact phrase, but also tweets containing only "michelle", others containing only "bachelet", and others containing both "michelle" and "bachelet" with different distances between those two words. In general AND, OR and exact phrase queries throws all three types of results.
I will appreciate any help with this issue.
The
def next(self): was not working correctly it would return all of the items in the list except the last one.
So if I had tweeted the following
I would only get the following returned.
Below is the correct code for def next(self):
def next(self):
if self.nextTweet < len(self.response['content']['statuses']):
strresponse = self.response['content']['statuses'][self.nextTweet]
self.nextTweet += 1
return strresponse
try:
self.searchNextResults()
except TwitterSearchException:
raise StopIteration
if len(self.response['content']['statuses']) != 0:
self.nextTweet = 0
return self.response['content']['statuses'][self.nextTweet]
raise StopIteration
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.