Created
October 23, 2017 07:47
-
-
Save Yuiki/38ebca4ebae3197ae20571e71f201164 to your computer and use it in GitHub Desktop.
#コンテンツ応用論2017 で30ツイートつぶやくやつ
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
import tweepy | |
from datetime import datetime, timezone | |
# ここらへん入れてね | |
auth = tweepy.OAuthHandler('', '') | |
auth.set_access_token('', '') | |
api = tweepy.API(auth) | |
tag = '#コンテンツ応用論2017' | |
now_day = datetime.now(timezone.utc).day | |
while True: | |
text = input() + ' ' + tag | |
api.update_status(text) | |
print("ツイートを送信しました") | |
count = 0 | |
# 講義当日以外につぶやくならここらへん書き換えてね | |
for status in api.user_timeline(count=200): | |
status_day = status.created_at.day | |
if now_day == status_day and tag in status.text: | |
count = count + 1 | |
if 30 - count > 0: | |
print('残り' + str(30 - count) + 'ツイートです') | |
else: | |
print(str(count) + 'ツイート目です') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment