Skip to content

Instantly share code, notes, and snippets.

@sakakendo
Created October 4, 2019 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakakendo/b11bcccf5e2b2cf62bc14e17387bfa3f to your computer and use it in GitHub Desktop.
Save sakakendo/b11bcccf5e2b2cf62bc14e17387bfa3f to your computer and use it in GitHub Desktop.
めちゃくちゃ雑にtwitterでつぶやいたurlを収集するスクリプト
CK=""
CS=""
AT=""
AS=""
twitter=OAuth1Session(CK,CS,AT,AS)
def getTimeline():
param={'count':200}
url='https://api.twitter.com/1.1/statuses/home_timeline.json'
req=twitter.get(url,params=param)
if req.status_code == 200:
timeline=json.loads(req.text)
for tweet in timeline:
# print('* ',tweet['text'])
urls = tweet.get('entities').get('urls')
for url in urls:
print(url.get('display_url'))
else:
print("Error :"+str(req.status_code))
getTimeline()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment