I am trying to use the pytchat library to get information about my moderated livestream chats. The two main pieces of information I want are these: the message text (I can get this reliably) and the comment id (less reliable apparently). The pytchat library allows access to YouTube request information in a variety of different ways. All seem to give me the same botched output. Using this code:
from pytchat import CompatibleProcessor, createimport time, syschat_ = create(sys.argv[1], processor = CompatibleProcessor())while chat_.is_alive(): try: data = chat_.get() polling = data['pollingIntervalMillis']/1000 for c in data['items']: if c.get('snippet'): print(c['snippet']['displayMessage'] +' || '+ c['id']) time.sleep(polling/len(data['items'])) except KeyboardInterrupt: chat_.terminate()I get a readout of every comment as it is provided by YouTube. The message bit is fine. c['id'] however is a different story. The comment ids stored by this element are usually formatted in this way:
LCC.CjkKGkNQRHhoYUNEdVBrQ0ZWRzE1UWNkdEhZQzlREhtDT0dDMFBYMXRfa0NGWTZUd2dFZDdkZ0Uydzk%3DThis is not an actual comment id. I know as much, because whenever I pass this comment id to YouTube API in a delete request I get the following:
{'error': {'code': 404, 'message': 'The liveChatMessage that you are trying to delete cannot be found.', 'errors': [{'message': 'The liveChatMessage that you are trying to delete cannot be found.', 'domain': 'youtube.liveChat', 'reason': 'liveChatMessageNotFound'}]}}Making a POST request with curl yields a different style of comment id:
LCC.CjgKDQoLQlRERDlEYVFZdHMqJwoYVUMxSE1UdDVjb0VWNi1tV1BhZEJRU0l3EgtCVEREOURhUVl0cxI5ChpDUER4aGFDRHVQa0NGVkcxNVFjZHRIWUM5URIbQ09HQzBQWDF0X2tDRlk2VHdnRWQ3ZGdFMnc5I haven't tried deleting comments with this type of comment id, but just looking at it makes me think it is infinitely more valid than whatever is being supplied by pytchat.
Is this expected behavior for pytchat? I haven't seen anyone else use the library this way. If so, how can I get the actual comment id? (preferably without supplying any authorization tokens)