feat✨: 优化b站解析

This commit is contained in:
HibiKier
2024-07-29 23:31:11 +08:00
parent d4a49a47e5
commit c219264968
8 changed files with 391 additions and 197 deletions
@@ -0,0 +1,60 @@
class InformationContainer:
def __init__(
self,
vd_info=None,
live_info=None,
vd_url=None,
live_url=None,
image_info=None,
image_url=None,
):
self._vd_info = vd_info
self._live_info = live_info
self._vd_url = vd_url
self._live_url = live_url
self._image_info = image_info
self._image_url = image_url
@property
def vd_info(self):
return self._vd_info
@property
def live_info(self):
return self._live_info
@property
def vd_url(self):
return self._vd_url
@property
def live_url(self):
return self._live_url
@property
def image_info(self):
return self._image_info
@property
def image_url(self):
return self._image_url
def update(self, updates):
"""
更新多个信息的通用方法
Args:
updates (dict): 包含信息类型和对应新值的字典
"""
for info_type, new_value in updates.items():
if hasattr(self, f"_{info_type}"):
setattr(self, f"_{info_type}", new_value)
def get_information(self):
return (
self.vd_info,
self.live_info,
self.vd_url,
self.live_url,
self.image_info,
self.image_url,
)