def fetchsamples(limit):
ret = []
url = "https://stream.twitter.com/1/statuses/sample.json"
parameters = []
while len(ret) < limit:
try:
response = twitterreq(url, "GET", parameters)
for line in response:
ret.append(line.strip())
if len(ret) % 100 == 0:
print len(ret)
if len(ret) >= limit:
break
except IncompleteRead:
pass
except BadStatusLine:
pass
return ret
# filter tweets for images / good captions and output them to file
评论列表
文章目录