Skip to content

Instantly share code, notes, and snippets.

@tamago324
Created March 28, 2020 05:17
Show Gist options
  • Save tamago324/e5db25bc765833986d8e14d6612ff63f to your computer and use it in GitHub Desktop.
Save tamago324/e5db25bc765833986d8e14d6612ff63f to your computer and use it in GitHub Desktop.
from pytwitcasting import auth, api
import time
import pyperclip
client_id = "取得した値"
client_secret = "取得した値"
app_basis = auth.TwitcastingApplicationBasis(
client_id=client_id, client_secret=client_secret
)
api = api.API(application_basis=app_basis)
user = api.get_user_info("taniko_t_tanio_")
slice_id = None
while True:
# 1秒スリープ
time.sleep(1)
# ライブ中
if user.is_live:
movie = user.get_current_live()["movie"]
# コメントを取得
for comment in movie.get_comments(slice_id=slice_id)["comments"]:
# 保持
slice_id = comment.id
# print(comment.from_user.name, comment.message)
pyperclip.copy("{} さん {}".format(comment.from_user.name, comment.message))
@tamago324
Copy link
Author

$ poetry add pytwitcasting pyperclip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment