Created
October 4, 2019 08:18
-
-
Save sakakendo/b11bcccf5e2b2cf62bc14e17387bfa3f to your computer and use it in GitHub Desktop.
めちゃくちゃ雑にtwitterでつぶやいたurlを収集するスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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