feat(yandexweather): add yandexweather api

This commit is contained in:
2026-08-28 10:01:49 +03:00
parent a92b63b855
commit 50c4221b8d
33 changed files with 506 additions and 74 deletions
+5 -3
View File
@@ -11,11 +11,13 @@ logger = logging.getLogger("matchtv")
class MatchTvApi(ScheduleApi):
PROVIDER = "matchtv"
SOURCE = ApiSource("https://matchtv.ru")
def _build_source(self) -> ApiSource:
return ApiSource("https://matchtv.ru")
async def find_channels(self, query: str) -> list[Channel]:
endpoint = "api/v1/channels"
data = json.loads(await self.SOURCE.request(endpoint))
data = json.loads(await self.source.request(endpoint))
result = []
query = query.lower()
for item in data["result"]:
@@ -27,7 +29,7 @@ class MatchTvApi(ScheduleApi):
async def get_schedule(self, channel_id: str, date: datetime.date) -> Schedule:
endpoint = f"api/v1/channels/{channel_id}/tv-schedule?date={date:%Y%m%d}"
data = json.loads(await self.SOURCE.request(endpoint))
data = json.loads(await self.source.request(endpoint))
channel_data = data["result"]["channels"][0]
channel = Channel(id=channel_data["alias"], name=channel_data["name"], provider=self.provider)
values = []