mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-01 01:30:27 +08:00
18 lines
547 B
Python
18 lines
547 B
Python
from module.network import RequestContent
|
|
|
|
|
|
class BgmAPI:
|
|
def __init__(self):
|
|
self.search_url = lambda e: \
|
|
f"https://api.bgm.tv/search/subject/{e}?type=2"
|
|
self.info_url = lambda e: \
|
|
f"https://api.bgm.tv/subject/{e}"
|
|
|
|
def search(self, title):
|
|
url = self.search_url(title)
|
|
with RequestContent() as req:
|
|
contents = req.get_json(url)["list"]
|
|
if contents.__len__() == 0:
|
|
return None
|
|
return contents[0]["name"], contents[0]["name_cn"]
|