Giter Club home page Giter Club logo

Comments (10)

xenova avatar xenova commented on June 16, 2024

Thanks for the suggestion! I'm adding something that will be able to support live chat.

However, the only issue is that you cannot view the live chat for parts of the video that have already happened. You can only view the live chat for the current moment. In order to view the live chat for a time in the past, you have to wait until the end of the video.

For example, when accessing the continuations, the only keys that are visible are 'Top chat' and 'Live chat':
{'Top chat': '0ofMyAN1GmxDamdLRFFvTE0wWlFiVlp1WVVSNlFVMHFKd29ZVlVOclZFTk9kVkV5YlVkbVZ6WXRVM0JJY0dGNlpWOW5FZ3N6UmxCdFZtNWhSSHBCVFJvVDZxamR1UUVOQ2dzelJsQnRWbTVoUkhwQlRTQUIwAYIBAggE', 'Live chat': '0ofMyAN1GmxDamdLRFFvTE0wWlFiVlp1WVVSNlFVMHFKd29ZVlVOclZFTk9kVkV5YlVkbVZ6WXRVM0JJY0dGNlpWOW5FZ3N6UmxCdFZtNWhSSHBCVFJvVDZxamR1UUVOQ2dzelJsQnRWbTVoUkhwQlRTQUIwAYIBAggB'}

This is just from playing around with that is available - If you find a way to do it, let me know! :)

from chat-downloader.

xenova avatar xenova commented on June 16, 2024

So, what I am adding now is that you can view the live chat as it happens, but I don't think it's possible to be able to view the chat history while it is still happening. (Correct me if I'm wrong though!)

from chat-downloader.

xenova avatar xenova commented on June 16, 2024

Similarly, I don't think you can't view the timestamp text of the message being sent, only when it was sent (i.e. not relative to the start of the video). For example, you can't see "0:23:12" only "5PM"

from chat-downloader.

xenova avatar xenova commented on June 16, 2024

Okay I have added this in the latest version (6fcf9d2)
I've tested on my end and it seems to work, but let me know if it works for you and I will close the issue.

from chat-downloader.

Yay295 avatar Yay295 commented on June 16, 2024

It looks like there's a different key for if the stream hasn't even started yet. I'll submit my change.

from chat-downloader.

xenova avatar xenova commented on June 16, 2024

Okay great!

from chat-downloader.

Yay295 avatar Yay295 commented on June 16, 2024

I had this running as a stream ended and got this exception:

Traceback (most recent call last):
  File "chat_replay_downloader.py", line 278, in <module>
    chat_messages = chat_downloader.get_chat_replay(args.url,start_time=args.start_time, end_time=args.end_time)
  File "chat_replay_downloader.py", line 247, in get_chat_replay
    return self.get_youtube_messages(match.group(1), start_time, end_time)
  File "chat_replay_downloader.py", line 145, in get_youtube_messages
    info = self.__get_info(continuation,offset_milliseconds,is_live)
  File "chat_replay_downloader.py", line 103, in __get_info
    return info['response']['continuationContents']['liveChatContinuation']
KeyError: 'continuationContents'

I'd guess there might be a similar error when a stream goes live if you start this before it goes live.

It looks like all comments made after the stream ends are lost. There's probably nothing we can do about that. We do actually get a few more seconds than what is shown on YouTube though.

The messages we get while the stream is live are also not in order, but that does make sense since it's live.

We don't seem to be getting all of the messages though. I've got about 2.5 minutes of the end of a stream both before it ended, and from the replay, and there's a lot missing in the replay.

from chat-downloader.

Yay295 avatar Yay295 commented on June 16, 2024

Alright, I just replayed a stream on YouTube with Live Chat enabled and it showed the same messages as what we get with this program. It's a bit less than half of what I got while grabbing the messages when it was live though, so it seems like YouTube is actually throwing out a lot of messages. This could depend on the number of messages that were actually sent though, so streams with a slower chat could have fewer missing messages. It might also be that the stream is still being processed and the missing messages could show up eventually, but I wouldn't think that messages would take that long to process.

from chat-downloader.

xenova avatar xenova commented on June 16, 2024

Oh wow that's interesting.

I have added the case for when a live stream has ended while you are running the program, so that should be present in the next update (With #7 ). Unfortunately there's not much testing data, but the changes should fix this:

Traceback (most recent call last):
File "chat_replay_downloader.py", line 278, in
chat_messages = chat_downloader.get_chat_replay(args.url,start_time=args.start_time, end_time=args.end_time)
File "chat_replay_downloader.py", line 247, in get_chat_replay
return self.get_youtube_messages(match.group(1), start_time, end_time)
File "chat_replay_downloader.py", line 145, in get_youtube_messages
info = self.__get_info(continuation,offset_milliseconds,is_live)
File "chat_replay_downloader.py", line 103, in __get_info
return info['response']['continuationContents']['liveChatContinuation']
KeyError: 'continuationContents'

from chat-downloader.

xenova avatar xenova commented on June 16, 2024

Okay, new update is live (d65753c) - let me know if it works 👍

from chat-downloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.