def get_user_series(self, username: str, series_type: str):
"""
:param username: The name of the accounts information you're trying to get
:param series_type: If you're looking for manga or anime
:return type list:
"""
params = {
"u": username,
"status": 'all',
"type": series_type
}
if series_type not in ("anime", "manga"):
raise InvalidSeriesTypeException
else:
with aiohttp.ClientSession(auth=self._auth, headers={"User-Agent": self.user_agent}) as session:
async with session.get(MAL_APP_INFO, params=params) as response:
# Raise an error if we get the wrong response code
if response.status != 200:
raise ResponseError(response.status)
# Get the response text and set parser
soup = bs4.BeautifulSoup(await response.text(), "lxml")
return [dict(self.process_(child) for child in anime.children) for anime in soup.find_all(series_type)]
# End of bit Zeta wrote
评论列表
文章目录