File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -304,15 +304,16 @@ async def TwitterTweetAPI(
304304 try :
305305 # 画像をアップロードするタスク
306306 # TODO: 本来はここもヘッドレスブラウザ経由で送信すべきだが、おそらく画像の受け渡しが面倒なのと、
307- # upload.x.com のみ他の API と異なり v1.1 時代からほぼそのままでセキュリティも緩そうなので当面これで行く…
307+ # upload.x.com のみ他の API と異なり v1.1 時代からほぼそのままで Bot 対策も比較的緩そうなので当面これで行く…
308+ logging .info (f'[TwitterRouter][TwitterTweetAPI] Uploading { len (images )} images...' )
308309 tweepy_api = twitter_account .getTweepyAPI ()
309310 image_upload_task : list [Coroutine [Any , Any , Any | None ]] = []
310311 for image in images :
311312 image_upload_task .append (asyncio .to_thread (tweepy_api .media_upload ,
312313 filename = image .filename ,
313314 file = image .file ,
314315 # Twitter Web App の挙動に合わせて常にチャンク送信方式でアップロードする
315- chunk = True ,
316+ chunked = True ,
316317 # Twitter Web App の挙動に合わせる
317318 media_category = 'tweet_image' ,
318319 ))
@@ -322,6 +323,7 @@ async def TwitterTweetAPI(
322323 ## ref: https://developer.twitter.com/ja/docs/media/upload-media/api-reference/post-media-upload-init
323324 for image_upload_result in await asyncio .gather (* image_upload_task ):
324325 if image_upload_result is not None :
326+ logging .info (f'[TwitterRouter][TwitterTweetAPI] Uploaded image. [media_id: { image_upload_result .media_id } ]' )
325327 media_ids .append (str (image_upload_result .media_id ))
326328
327329 # 画像のアップロードに失敗した
You can’t perform that action at this time.
0 commit comments