1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add a few more properties

This commit is contained in:
Steffo 2019-04-14 18:58:06 +02:00
parent 034c0d0edc
commit 5968045ece
2 changed files with 16 additions and 7 deletions

View file

@ -61,14 +61,14 @@ class YtdlInfo:
self.channel_id: typing.Optional[str] = info.get("channel_id") self.channel_id: typing.Optional[str] = info.get("channel_id")
self.channel_url: typing.Optional[str] = info.get("channel_url") self.channel_url: typing.Optional[str] = info.get("channel_url")
self.upload_date: typing.Optional[str] = info.get("upload_date") self.upload_date: typing.Optional[str] = info.get("upload_date")
self.license: typing.Optional[...] = info.get("license") self.license: typing.Optional[str] = info.get("license")
self.creator: typing.Optional[...] = info.get("creator") self.creator: typing.Optional[...] = info.get("creator")
self.title: typing.Optional[str] = info.get("title") self.title: typing.Optional[str] = info.get("title")
self.alt_title: typing.Optional[...] = info.get("alt_title") self.alt_title: typing.Optional[...] = info.get("alt_title")
self.thumbnail: typing.Optional[str] = info.get("thumbnail") self.thumbnail: typing.Optional[str] = info.get("thumbnail")
self.description: typing.Optional[str] = info.get("description") self.description: typing.Optional[str] = info.get("description")
self.categories: typing.Optional[list] = info.get("categories") self.categories: typing.Optional[typing.List[str]] = info.get("categories")
self.tags: typing.Optional[list] = info.get("tags") self.tags: typing.Optional[typing.List[str]] = info.get("tags")
self.subtitles: typing.Optional[dict] = info.get("subtitles") self.subtitles: typing.Optional[dict] = info.get("subtitles")
self.automatic_captions: typing.Optional[dict] = info.get("automatic_captions") self.automatic_captions: typing.Optional[dict] = info.get("automatic_captions")
self.duration: typing.Optional[int] = info.get("duration") self.duration: typing.Optional[int] = info.get("duration")
@ -81,7 +81,7 @@ class YtdlInfo:
self.dislike_count: typing.Optional[int] = info.get("dislike_count") self.dislike_count: typing.Optional[int] = info.get("dislike_count")
self.average_rating: typing.Optional[...] = info.get("average_rating") self.average_rating: typing.Optional[...] = info.get("average_rating")
self.formats: typing.Optional[list] = info.get("formats") self.formats: typing.Optional[list] = info.get("formats")
self.is_live: typing.Optional[...] = info.get("is_live") self.is_live: typing.Optional[bool] = info.get("is_live")
self.start_time: typing.Optional[...] = info.get("start_time") self.start_time: typing.Optional[...] = info.get("start_time")
self.end_time: typing.Optional[...] = info.get("end_time") self.end_time: typing.Optional[...] = info.get("end_time")
self.series: typing.Optional[...] = info.get("series") self.series: typing.Optional[...] = info.get("series")
@ -94,7 +94,7 @@ class YtdlInfo:
self.extractor_key: typing.Optional[str] = info.get("extractor_key") self.extractor_key: typing.Optional[str] = info.get("extractor_key")
self.playlist: typing.Optional[...] = info.get("playlist") self.playlist: typing.Optional[...] = info.get("playlist")
self.playlist_index: typing.Optional[...] = info.get("playlist_index") self.playlist_index: typing.Optional[...] = info.get("playlist_index")
self.thumbnails: typing.Optional[list] = info.get("thumbnails") self.thumbnails: typing.Optional[typing.List[typing.Dict[str, str]]] = info.get("thumbnails")
self.display_id: typing.Optional[str] = info.get("display_id") self.display_id: typing.Optional[str] = info.get("display_id")
self.requested_subtitles: typing.Optional[...] = info.get("requested_subtitles") self.requested_subtitles: typing.Optional[...] = info.get("requested_subtitles")
self.requested_formats: typing.Optional[tuple] = info.get("requested_formats") self.requested_formats: typing.Optional[tuple] = info.get("requested_formats")

View file

@ -16,9 +16,18 @@ class VideoinfoCommand(Command):
for info in info_list: for info in info_list:
info_dict = info.__dict__ info_dict = info.__dict__
message = f"🔍 Dati di [b]{info}[/b]:\n" message = f"🔍 Dati di [b]{info}[/b]:\n"
for key in __dict__: for key in info_dict:
# Skip description
if key == "description":
continue
# Skip formats
if key == "formats":
continue
if key == "requested_formats":
continue
# Skip empty keys
if info_dict[key] is None: if info_dict[key] is None:
continue continue
message += f"{key}: [b]{info_dict[key]}[/b]\n" message += f"[c]{key}[/c]: {info_dict[key]}\n"
await call.reply(message) await call.reply(message)
await asyncio.sleep(0.2) await asyncio.sleep(0.2)