質問編集履歴

3

対処した方法を追加

2020/08/08 12:28

投稿

kipipipi
kipipipi

スコア60

test CHANGED
File without changes
test CHANGED
@@ -43,3 +43,61 @@
43
43
  以下省略
44
44
 
45
45
  ```
46
+
47
+
48
+
49
+ ```python
50
+
51
+ #変数名がちょっとアレですが、こちらでターゲットのアカウントのツイートを取得できるようになりました。
52
+
53
+ can110様ありがとうございます!
54
+
55
+
56
+
57
+ d_today = datetime.date.today()
58
+
59
+ since_day = d_today - datetime.timedelta(days=1)
60
+
61
+
62
+
63
+ aTime = datetime.time(00, 00, 1)
64
+
65
+ bTime = datetime.time(00, 00, 00)
66
+
67
+ aT_native = dt.combine(d_today, aTime)
68
+
69
+ bT_native = dt.combine(since_day, bTime)
70
+
71
+ today_daytime = pytz.timezone('Asia/Tokyo').localize(aT_native)
72
+
73
+ since_daytime = pytz.timezone('Asia/Tokyo').localize(bT_native)
74
+
75
+
76
+
77
+
78
+
79
+ for Name,Account in Twitter_Account.items() :
80
+
81
+ tweet_data = []
82
+
83
+ for tweet in tweepy.Cursor(api.user_timeline,screen_name = Account,exclude_replies = True).items():
84
+
85
+ # ツイート時間を日本時間に変換
86
+
87
+ jst_timestamp = pytz.timezone('Asia/Tokyo').localize( tweet.created_at + datetime.timedelta(hours=9) )
88
+
89
+ if jst_timestamp < since_daytime:
90
+
91
+ continue
92
+
93
+ if jst_timestamp < today_daytime:
94
+
95
+ updateJST = jst_timestamp.strftime('%Y-%m-%d %H:%M:%S')
96
+
97
+ tweet_data.append([tweet.id,updateJST,tweet.text.replace('\n',''),tweet.favorite_count,tweet.retweet_count])
98
+
99
+
100
+
101
+
102
+
103
+ ```

2

混乱させる記述を変更

2020/08/08 12:28

投稿

kipipipi
kipipipi

スコア60

test CHANGED
File without changes
test CHANGED
@@ -17,8 +17,6 @@
17
17
  省略
18
18
 
19
19
 
20
-
21
- Account = 指定アカウント
22
20
 
23
21
  d_today = datetime.date.today()
24
22
 

1

誤字脱字

2020/08/08 05:09

投稿

kipipipi
kipipipi

スコア60

test CHANGED
File without changes
test CHANGED
@@ -22,8 +22,6 @@
22
22
 
23
23
  d_today = datetime.date.today()
24
24
 
25
- csv_base = '_' + str(d_today) + '.csv'
26
-
27
25
  base_since = '_00:00:00_JST'
28
26
 
29
27
  base_until = '_23:59:59_JST'