Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pytchat
- import time
- messagecount = 0
- SupaCount = 0
- ImportantMessageCount = 0
- start_time = time.time()
- #kcGhMnL2l2c #c7GwPw-72Ds #7-y8bVOb-cs #ipZOd9ESdlo
- vidID = input("Enter YoutubeID: ")
- OutputFile = open(vidID + ".txt", "a", encoding="utf8")
- print(vidID)
- chat = pytchat.create(video_id=vidID)
- print(chat.is_alive())
- while not chat.is_alive():
- print("Chat not yet up!")
- time.sleep(15)
- while chat.is_alive():
- #print(chat.get().json())
- #time.sleep(5)
- # Each chat item can also be output in JSON format.
- for c in chat.get().sync_items():
- messagecount += 1
- if c.type == "superChat" or c.type == "superSticker":
- SupaCount += 1
- print(f"{c.datetime}||{SupaCount}||{c.author.name}||{c.amountValue}||{c.currency}||{c.bgColor}||{c.message}")
- OutputFile.write(f"{c.datetime}||{SupaCount}||{c.author.name}||{c.amountValue}||{c.currency}||{c.bgColor}||{c.message}" + '\n')
- #print(c.json())
- elif c.author.isChatOwner or c.author.isChatModerator:
- ImportantMessageCount += 1
- print(f"{c.datetime}||[{c.author.name}]||{c.message}")
- OutputFile.write(f"{c.datetime}||[{c.author.name}]||{c.message}" + '\n')
- #if messagecount % 50 == 0:
- # print("--- %s seconds ---" % (time.time() - start_time))
- print("--- %s seconds ---" % (time.time() - start_time))
- OutputFile.write("--- %s seconds ---" % (time.time() - start_time) + '\n')
- print(f"{messagecount} Messages, {SupaCount} SC, {ImportantMessageCount} Mod-Owner")
- OutputFile.write(f"{messagecount} Messages, {SupaCount} SC, {ImportantMessageCount} Mod-Owner" + '\n')
- OutputFile.close()
- try:
- chat.raise_for_status()
- except pytchat.exceptions.ChatDataFinished:
- print("chat data finished")
- except Exception as e:
- print(type(e), str(e))
- ### don't judge me I don't know what the fuck I'm doing and haven't really finished and it's the ping my controller is broken
- #___________________________
- import pytchat
- from pytchat import HTMLArchiver
- import time
- #seektime - set this negative to retrieve prechat
- messagecount = 0
- SupaCount = 0
- ImportantMessageCount = 0
- start_time = time.time()
- #chat = pytchat.create(video_id="Ww8HYMWdA3E",force_replay = True)
- #kcGhMnL2l2c -- Oblivion 4 #uV27ZN4bFsI #ITGeJV9xcZk -- Member Hangout 3/7 #Unph-P3vsfA -- Kiara Member Emote Draw -20/12/09 #16u2G57o6GE -- 6mo collab - Ame
- vidID = input("Enter YoutubeID: ")
- OutputFile = open(vidID + ".txt", "a", encoding="utf8")
- print(vidID)
- chat = pytchat.create(video_id=vidID,force_replay = True)
- while chat.is_alive():
- #print(chat.get().json())
- #time.sleep(5)
- # Each chat item can also be output in JSON format.
- #for c in chat.get().sync_items():
- for c in chat.get().items:
- messagecount += 1
- #time.sleep(0.1)
- if c.type == "superChat" or c.type == "superSticker":
- SupaCount += 1
- print(f"{c.datetime}||{SupaCount}||{c.author.name}||{c.amountValue}||{c.currency}||{c.bgColor}||{c.message}")
- OutputFile.write(f"{c.datetime}||{SupaCount}||{c.author.name}||{c.amountValue}||{c.currency}||{c.bgColor}||{c.message}" + '\n')
- elif c.author.isChatOwner or c.author.isChatModerator:
- ImportantMessageCount += 1
- print(f"{c.datetime}||[{c.author.name}]||{c.message}")
- OutputFile.write(f"{c.datetime}||[{c.author.name}]||{c.message}" + '\n')
- #if messagecount % 2000 == 0:
- #print("--- %s seconds --- processed %s messages ---" % (time.time() - start_time, messagecount))
- print("--- %s seconds ---" % (time.time() - start_time))
- OutputFile.write("--- %s seconds ---" % (time.time() - start_time) + '\n')
- print(f"{messagecount} Messages, {SupaCount} SC, {ImportantMessageCount} Mod-Owner")
- OutputFile.write(f"{messagecount} Messages, {SupaCount} SC, {ImportantMessageCount} Mod-Owner" + '\n')
- OutputFile.close()
- try:
- chat.raise_for_status()
- except pytchat.exceptions.ChatDataFinished:
- print("chat data finished")
- except Exception as e:
- print(type(e), str(e))
Add Comment
Please, Sign In to add comment