123456789101112131415161718192021222324252627282930313233343536373839 |
- # This script will take messages send in the stream and give me to look at them.
- # GPLv3 or Later (C) J.Y.Amihud 2021
- import websocket # to install this use 'sudo pip3 install websocket-client'
- import json
- import os
- claim_id = input("Listen to claim: ")
- def on_message(wsapp, message):
- comment = "Some Error!"
- person = "Anonymous"
- support = 0
- print()
- print(message)
- print()
-
- try:
- m = json.loads(message)
- m = m["data"]
- comment = m["comment"]["comment"].replace("\n", " ").replace("'", "*")
- person = m["comment"]["channel_name"]
- support = m["comment"]["support_amount"]
- except Exception as e:
-
- print("ERROR!", e)
- os.system("notify-send -a 'Odysee LiveChat' '"+person+" "+str(support)+" LBC' '"+comment+"'")
- print()
- print(person)
- print(support)
- print(comment)
- print()
- wsapp = websocket.WebSocketApp("wss://comments.lbry.com/api/v2/live-chat/subscribe?subscription_id="+claim_id, on_message=on_message)
- wsapp.run_forever()
|