Giter Club home page Giter Club logo

Comments (2)

xenova avatar xenova commented on June 19, 2024

Hi there! The new version now uses generators to manage chat objects :) This makes it a lot easier to define better/more complex callback options. As an example:

from chat_replay_downloader import ChatDownloader
video_id = 'J2umj9SgdFU'  
chat = ChatDownloader().get_chat(video_id) # creates a generator
for message in chat: # you can now iterate over it!
    print(message) # callback goes here

would continue outputting:

{'action_type': 'add_chat_item', 'message': 'finally Vishy with new camera angle', 'message_id': 'CkUKGkNQX2cyLS1QeHU0Q0ZmSU1mUW9kVTMwTDRBEidDSi1ScWRLUHh1NENGZXFEckFJZF9pUUhZUTE2MTIwOTQ0NjQ0ODY%3D', 'timestamp': 1612094465568923, 'author': {'name': 'Samir Ghimire', 'images': [{'url': 'https://yt3.ggpht.com/ytc/AAUvwni2C4pmWWWjaxY2ZUnFjYqiyCpD3Y-mXhozkw=s32-c-k-c0xffffffff-no-rj-mo', 'width': 32, 'height': 32, 'id': '32x32'}, {'url': 'https://yt3.ggpht.com/ytc/AAUvwni2C4pmWWWjaxY2ZUnFjYqiyCpD3Y-mXhozkw=s64-c-k-c0xffffffff-no-rj-mo', 'width': 64, 'height': 64, 'id': '64x64'}], 'id': 'UCD-RwEzxUzl1MsSpc-AwMtw'}, 'message_type': 'text_message'}
{'action_type': 'add_chat_item', 'message': 'ohh thank you', 'message_id': 'CkUKGkNPWHotLS1QeHU0Q0ZYMGVyUVlkVmxzR1BnEidDTUhEOXE2UHh1NENGZUhyT0FZZGNUd0NDZzE2MTIwOTQ0NjU1NDI%3D', 'timestamp': 1612094466095675, 'author': {'name': 'Bilal Dwianugrah', 'images': [{'url': 'https://yt3.ggpht.com/ytc/AAUvwngONPUrnE6jnDHU48XbXmcj5XAjz1K86KMjFA=s32-c-k-c0xffffffff-no-rj-mo', 'width': 32, 'height': 32, 'id': '32x32'}, {'url': 'https://yt3.ggpht.com/ytc/AAUvwngONPUrnE6jnDHU48XbXmcj5XAjz1K86KMjFA=s64-c-k-c0xffffffff-no-rj-mo', 'width': 64, 'height': 64, 'id': '64x64'}], 'id': 'UCFb-yF95C1QOrFNWYCAc3Zw'}, 'message_type': 'text_message'}

I will be adding a lot of documentation soon! I just had to release this relatively unpolished version because of YouTube API endpoint changes.

from chat-downloader.

lekoOwO avatar lekoOwO commented on June 19, 2024

Ohhhh it's now a generator, that's really great!
Thank you!

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.