Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #coding: utf-8
- #!/usr/bin/env python
- # -*- coding: UTF-8 -*-
- from __future__ import absolute_import, print_function, unicode_literals
- import tweepy
- import sys
- import os
- import io, json
- from pprint import pprint
- import time
- import jsonpickle
- auth = tweepy.AppAuthHandler('','')
- api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
- if (not api):
- print("problem connection to API")
- api.rate_limit_status()['resources']['search']
- searchQuery = 'place:08b2d74428e2ca88 "مرحبا" OR "السلام" '
- maxTweets = 100 #1000000
- searched_tweets = [status._json for status in tweepy.Cursor(api.search, q=searchQuery).items(maxTweets)]
- json_strings = [json.dumps(json_obj, ensure_ascii=False) for json_obj in searched_tweets]
- tweetCount = 0
- with io.open ('SAUDI.json','w', encoding = 'utf-8') as f:
- for tweet in json_strings:
- json.dump(tweet, f, ensure_ascii= False)
- tweetCount += 1
- print("Downloaded {0} tweets".format(tweetCount))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement