Skip to content

Commit

Permalink
Add video_author field to YoutubeChatRecord
Browse files Browse the repository at this point in the history
Regenerate PLUGINS.md
  • Loading branch information
user committed Mar 11, 2024
1 parent 41bcc1a commit 06c1a4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PLUGINS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<!-- This file is autogenerated as part of avtdl 0.9.dev0+ga5c0e58.d20240216 at 2024-03-11 00:27:01.473372 -->
<!-- This file is autogenerated as part of avtdl 0.9.dev0+ga5c0e58.d20240216 at 2024-03-11 00:42:28.976228 -->

## Description and configuration of available plugins
### Table of content:
Expand Down Expand Up @@ -657,6 +657,7 @@ Youtube chat message
* `color`: message header color (RGB integer), if present.
* `video_id`: video_id of the video chat message was sent to.
* `video_title`: title of the video chat message was sent to.
* `video_author`: name of the channel where the video chat message was sent to is published.
* `uid`: unique id of the message.
* `action`: internal name of message type. Used for debug purposes.
* `renderer`: internal name of message format. Used for debug purposes.
Expand Down
5 changes: 5 additions & 0 deletions avtdl/plugins/youtube/youtube_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class YoutubeChatRecord(Record):
"""video_id of the video chat message was sent to"""
video_title: str = ''
"""title of the video chat message was sent to"""
video_author: str = ''
"""name of the channel where the video chat message was sent to is published"""

uid: str
"""unique id of the message"""
Expand Down Expand Up @@ -112,6 +114,7 @@ class ChatPageContext(NextPageContext):
continuation_url: Optional[str] = None
base_update_interval: float = 120
done: bool = False
video_author: str = ''
video_title: str = ''
video_id: str = ''

Expand Down Expand Up @@ -167,6 +170,7 @@ async def get_records(self, entity: YoutubeChatMonitorEntity, session: aiohttp.C
records = Parser().run_parsers(new_actions)
for record in records:
record.video_id = entity.context.video_id
record.video_author = entity.context.video_author
record.video_title = entity.context.video_title
new_update_interval = self._new_update_interval(entity, len(records))
# entity.update_interval gets updated by self.request()
Expand Down Expand Up @@ -197,6 +201,7 @@ async def _get_first(self, entity: YoutubeChatMonitorEntity, session: aiohttp.Cl

entity.context.video_id = info.video_id
entity.context.video_title = info.title
entity.context.video_author = info.author

message = find_one(initial_page, '$..conversationBar.conversationBarRenderer.availabilityMessage.messageRenderer.text')
if message is not None:
Expand Down

0 comments on commit 06c1a4f

Please sign in to comment.