Comments (10)
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.
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.
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.
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.
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.
Okay great!
from chat-downloader.
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.
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.
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.
Okay, new update is live (d65753c) - let me know if it works 👍
from chat-downloader.
Related Issues (20)
- Exception: "Expecting value: line 1 column 1 (char 0)" when trying to get Twitch chat HOT 2
- [Bug] Outdated library for identifying Twitch chatmessages
- [BUG] Youtube live links 404 not found HOT 1
- [BUG] "AttributeError: 'NoneType' object has no attribute 'get'" when trying to get Twitch chats HOT 1
- [BUG] "Unable to find initial video contents" when trying to get chat on Youtube with cookies. HOT 2
- [BUG] YouTube changed something. Unable to parse initial video data. HOT 10
- [BUG] On my pc it works but on my friend's it doesn't HOT 5
- how can stop sesion chat?
- [QUESTION] How do I get chat log from start of live youtube broadcast? HOT 3
- REMOVE THIS, THANKS
- Incomplete Parsing of Fundraising Donation Messages in Live Chat HOT 2
- [QUESTION] Title goes here
- ModuleNotFoundError: No module named 'chardet'
- [QUESTION] How can I stop chat downloader if the livestreaming is offline
- [FEATURE] [Twitch] Add `{datetime}` in ouput operation
- [FEATURE] [Youtube] Add filter for stream announce
- [FEATURE] create_clip function
- [BUG] Filename string after --output cannot begin with dash(-) due to mis-interpretated as option HOT 5
- [BUG] socs.value missing from cookies
- CHAT STOPED AFTER ANY TIME HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chat-downloader.