diff --git a/gallery/painting/matchtv/api.py b/gallery/painting/matchtv/api.py
index f12d870..0cf5dc7 100644
--- a/gallery/painting/matchtv/api.py
+++ b/gallery/painting/matchtv/api.py
@@ -2,8 +2,6 @@ import datetime
import json
import logging
-from bs4 import BeautifulSoup
-
from gallery.sketch.schedule.api import ScheduleApi
from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue
from gallery.sketch.source import ApiSource
@@ -55,34 +53,3 @@ class MatchTvApi(ScheduleApi):
date=date,
values=values,
)
-
- async def get_schedule_legacy(self, channel_id: str, date: datetime.date) -> Schedule:
- endpoint = f"tvguide/{channel_id}?date={date:%Y%m%d}"
- data = await self.SOURCE.request(endpoint)
- soup = BeautifulSoup(data, features="html.parser")
- values = []
- channel_name = soup.select_one(".p-tv-guide-header__title").text.replace("Телепрограмма ", "").strip()
- current_day = datetime.datetime.combine(date.today(), datetime.datetime.min.time())
- end = current_day + datetime.timedelta(days=1, hours=6)
- prev_value: ScheduleValue | None = None
- for item in soup.select(
- ".p-tv-guide-schedule-channel-carcass__transmissions .p-tv-guide-schedule-channel-transmission"
- ):
- title = item.select_one(".p-tv-guide-schedule-channel-transmission__title").text.strip()
- time_str = item.select_one(".p-tv-guide-schedule-channel-transmission__time-block").text.strip()
- hours, minutes = map(int, time_str.split(":"))
- item_date = current_day.replace(hour=hours, minute=minutes)
- if prev_value is not None and item_date.hour < prev_value.start.hour:
- current_day += datetime.timedelta(days=1)
- item_date += datetime.timedelta(days=1)
- live = "Прямая трансляция" in title
- value = ScheduleValue(start=item_date, end=end, label=title, live=live)
- values.append(value)
- if prev_value is not None:
- prev_value.end = item_date
- prev_value = value
- return Schedule(
- channel=Channel(id=channel_id, name=channel_name, provider=self.provider),
- date=date,
- values=values,
- )
diff --git a/scripts/test b/scripts/test
index 621b46d..c5e3c75 100755
--- a/scripts/test
+++ b/scripts/test
@@ -2,4 +2,4 @@
set -e
cd "$(dirname $(dirname "$0"))" || exit
-poetry run pytest tests
+OPENWEATHER_KEY="" poetry run pytest tests
diff --git a/tests/data/matchtv/__init__.py b/tests/data/matchtv/__init__.py
index 59c5bc3..70010a4 100644
--- a/tests/data/matchtv/__init__.py
+++ b/tests/data/matchtv/__init__.py
@@ -5,7 +5,7 @@ from tests.common.mock import MockSource
MATCHTV_MOCK_SOURCE = MockSource(
Path(__file__).parent,
{
- "test": "test.html",
+ "test": "test.json",
"channels": "channels.json",
},
)
diff --git a/tests/data/matchtv/test.html b/tests/data/matchtv/test.html
deleted file mode 100644
index 0cf6da1..0000000
--- a/tests/data/matchtv/test.html
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
Канал Матч ТВ - телепрограмма на сегодня, завтра, неделю, смотреть программу передач онлайн06:00
"Чемпионат мира-2026. Обратный отсчёт" [12+]07:05
Все на Матч! Прямой эфир09:05
Специальный репортаж [12+]09:25
"Эволюция спорта" [12+]10:30
Футбол. Чемпионат Италии. Обзор тура [6+]11:35
Все на Матч! Прямой эфир12:35
Специальный репортаж [12+]13:00
"Есть тема!" Прямой эфир14:25
"Чемпионат мира-2026. Обратный отсчёт" [12+]15:35
Смешанные единоборства. UFC. Гилберт Бёрнс против Шона Брэди. Трансляция из США [16+]17:50
Все на Матч! Прямой эфир19:15
Хоккей. Фонбет Чемпионат КХЛ. 1/4 финала. "Торпедо" (Нижний Новгород) - "Металлург" (Магнитогорск). Прямая трансляция22:00
Бильярд. "BetBoom Лига Чемпионов". Прямая трансляция из Москвы23:35
Все на Матч! Прямой эфир01:00
Футбол. Чемпионат Италии. Обзор тура [6+]02:00
Баскетбол. Единая лига ВТБ. "Зенит" (Санкт-Петербург) - УНИКС (Казань) [6+]04:00
Стрельба из лука. Кубок мира. Трансляция из Мексики [6+]
\ No newline at end of file
diff --git a/tests/data/matchtv/test.json b/tests/data/matchtv/test.json
new file mode 100644
index 0000000..8a6d63d
--- /dev/null
+++ b/tests/data/matchtv/test.json
@@ -0,0 +1,115 @@
+{
+ "result": {
+ "info": {
+ "filters": [
+ "\u0444\u0443\u0442\u0431\u043e\u043b",
+ "\u0445\u043e\u043a\u043a\u0435\u0439",
+ "\u0435\u0434\u0438\u043d\u043e\u0431\u043e\u0440\u0441\u0442\u0432\u0430",
+ "\u0431\u0430\u0441\u043a\u0435\u0442\u0431\u043e\u043b",
+ "\u0431\u0438\u0430\u0442\u043b\u043e\u043d",
+ "\u043b\u044b\u0436\u0438"
+ ],
+ "availableDates": { "min": "2026-06-24T00:00:00+03:00", "max": "2026-07-05T00:00:00+03:00" }
+ },
+ "channels": [
+ {
+ "id": 10,
+ "tvChannelId": 130,
+ "alias": "matchtv",
+ "name": "\u041c\u0430\u0442\u0447 \u0422\u0412",
+ "url": "\/channel\/matchtv",
+ "icon": "https:\/\/fb-cdn.matchtv.ru\/files\/default\/upload\/4fbd\/42cc\/4fbd42ccdde063ff630a7970dbce1034.png",
+ "currentTransmissionProgress": 97,
+ "schedule": [
+ {
+ "time": "06:00",
+ "title": "\u0412\u0441\u0435 \u043d\u0430 \u041c\u0430\u0442\u0447! \u041f\u0440\u044f\u043c\u043e\u0439 \u044d\u0444\u0438\u0440",
+ "genre": "",
+ "current": false
+ },
+ { "time": "09:00", "title": "\u041d\u043e\u0432\u043e\u0441\u0442\u0438", "genre": "", "current": false },
+ {
+ "time": "09:05",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. 1\/16 \u0444\u0438\u043d\u0430\u043b\u0430. \u041a\u043e\u0442-\u0434\u0027\u0418\u0432\u0443\u0430\u0440 - \u041d\u043e\u0440\u0432\u0435\u0433\u0438\u044f. \u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0438\u0437 \u0421\u0428\u0410 [6+]",
+ "genre": "\u0444\u0443\u0442\u0431\u043e\u043b",
+ "current": false
+ },
+ {
+ "time": "11:20",
+ "title": "\u0423\u043b\u0451\u0442\u043d\u044b\u0439 \u0444\u0443\u0442\u0431\u043e\u043b. \u041f\u0440\u044f\u043c\u043e\u0439 \u044d\u0444\u0438\u0440",
+ "genre": "",
+ "current": false
+ },
+ {
+ "time": "12:10",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. \u041e\u0431\u0437\u043e\u0440 [6+]",
+ "genre": "",
+ "current": false
+ },
+ { "time": "12:40", "title": "\u041d\u043e\u0432\u043e\u0441\u0442\u0438", "genre": "", "current": false },
+ {
+ "time": "12:45",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. 1\/16 \u0444\u0438\u043d\u0430\u043b\u0430. \u041c\u0435\u043a\u0441\u0438\u043a\u0430 - \u042d\u043a\u0432\u0430\u0434\u043e\u0440. \u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0438\u0437 \u041c\u0435\u043a\u0441\u0438\u043a\u0438 [6+]",
+ "genre": "\u0444\u0443\u0442\u0431\u043e\u043b",
+ "current": false
+ },
+ {
+ "time": "15:00",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. 1\/16 \u0444\u0438\u043d\u0430\u043b\u0430. \u0424\u0440\u0430\u043d\u0446\u0438\u044f - \u0428\u0432\u0435\u0446\u0438\u044f. \u0422\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0438\u0437 \u0421\u0428\u0410 [6+]",
+ "genre": "\u0444\u0443\u0442\u0431\u043e\u043b",
+ "current": false
+ },
+ {
+ "time": "17:15",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. \u041e\u0431\u0437\u043e\u0440 [6+]",
+ "genre": "",
+ "current": false
+ },
+ { "time": "17:45", "title": "\u041d\u043e\u0432\u043e\u0441\u0442\u0438", "genre": "", "current": false },
+ {
+ "time": "17:50",
+ "title": "\u0412\u0441\u0435 \u043d\u0430 \u041c\u0430\u0442\u0447! \u041f\u0440\u044f\u043c\u043e\u0439 \u044d\u0444\u0438\u0440",
+ "genre": "",
+ "current": false
+ },
+ {
+ "time": "18:30",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. 1\/16 \u0444\u0438\u043d\u0430\u043b\u0430. \u0410\u043d\u0433\u043b\u0438\u044f - \u0414\u0420 \u041a\u043e\u043d\u0433\u043e. \u041f\u0440\u044f\u043c\u0430\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0438\u0437 \u0421\u0428\u0410",
+ "genre": "\u0444\u0443\u0442\u0431\u043e\u043b",
+ "current": true
+ },
+ {
+ "time": "21:05",
+ "title": "\u0412\u0441\u0435 \u043d\u0430 \u041c\u0430\u0442\u0447! \u041f\u0440\u044f\u043c\u043e\u0439 \u044d\u0444\u0438\u0440",
+ "genre": "",
+ "current": false
+ },
+ {
+ "time": "22:00",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. 1\/16 \u0444\u0438\u043d\u0430\u043b\u0430. \u0411\u0435\u043b\u044c\u0433\u0438\u044f - \u0421\u0435\u043d\u0435\u0433\u0430\u043b. \u041f\u0440\u044f\u043c\u0430\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0438\u0437 \u0421\u0428\u0410",
+ "genre": "\u0444\u0443\u0442\u0431\u043e\u043b",
+ "current": false
+ },
+ {
+ "time": "01:05",
+ "title": "\u0412\u0441\u0435 \u043d\u0430 \u041c\u0430\u0442\u0447! \u041f\u0440\u044f\u043c\u043e\u0439 \u044d\u0444\u0438\u0440",
+ "genre": "",
+ "current": false
+ },
+ {
+ "time": "02:00",
+ "title": "\u0424\u0443\u0442\u0431\u043e\u043b. \u0427\u0435\u043c\u043f\u0438\u043e\u043d\u0430\u0442 \u043c\u0438\u0440\u0430-2026. 1\/16 \u0444\u0438\u043d\u0430\u043b\u0430. \u0421\u0428\u0410 - \u0411\u043e\u0441\u043d\u0438\u044f \u0438 \u0413\u0435\u0440\u0446\u0435\u0433\u043e\u0432\u0438\u043d\u0430. \u041f\u0440\u044f\u043c\u0430\u044f \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0438\u0437 \u0421\u0428\u0410",
+ "genre": "\u0444\u0443\u0442\u0431\u043e\u043b",
+ "current": false
+ },
+ {
+ "time": "05:05",
+ "title": "\u0412\u0441\u0435 \u043d\u0430 \u041c\u0430\u0442\u0447! \u041f\u0440\u044f\u043c\u043e\u0439 \u044d\u0444\u0438\u0440",
+ "genre": "",
+ "current": false
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/tests/data/openweather/__init__.py b/tests/data/openweather/__init__.py
index ef06b9d..49b1ade 100644
--- a/tests/data/openweather/__init__.py
+++ b/tests/data/openweather/__init__.py
@@ -6,6 +6,7 @@ OPENWEATHER_MOCK_SOURCE = MockSource(
Path(__file__).parent,
{
"forecast": "forecast.json",
- "direct": "geo-direct.json",
+ "direct": "direct.json",
+ "reverse": "reverse.json",
},
)
diff --git a/tests/data/openweather/geo-direct.json b/tests/data/openweather/direct.json
similarity index 100%
rename from tests/data/openweather/geo-direct.json
rename to tests/data/openweather/direct.json
diff --git a/tests/data/openweather/reverse.json b/tests/data/openweather/reverse.json
new file mode 100644
index 0000000..578aef3
--- /dev/null
+++ b/tests/data/openweather/reverse.json
@@ -0,0 +1,18 @@
+[
+ {
+ "name": "Oryol",
+ "local_names": {
+ "be": "Арол",
+ "ca": "Oriol",
+ "cs": "Orjol",
+ "de": "Orjol",
+ "en": "Oryol",
+ "ru": "Орёл",
+ "sr": "Орел"
+ },
+ "lat": 52.968017149999994,
+ "lon": 36.09949941816104,
+ "country": "RU",
+ "state": "Oryol Oblast"
+ }
+]
diff --git a/tests/test_matchtv_api.py b/tests/test_matchtv_api.py
index 11ae815..dc8e576 100644
--- a/tests/test_matchtv_api.py
+++ b/tests/test_matchtv_api.py
@@ -19,6 +19,6 @@ async def test_search(matchtv_api: MatchTvApi):
async def test_channel(matchtv_api: MatchTvApi):
- result = await matchtv_api.get_channel_schedule("test", datetime.date.today())
+ result = await matchtv_api.get_schedule("test", datetime.date.today())
assert result is not None
assert len(result.values) > 0
diff --git a/tests/test_yandextv_api.py b/tests/test_yandextv_api.py
index 686dfab..0f7a64f 100644
--- a/tests/test_yandextv_api.py
+++ b/tests/test_yandextv_api.py
@@ -15,10 +15,10 @@ def yandextv_api_fixture() -> YandexTvApi:
async def test_search(yandextv_api: YandexTvApi):
result = await yandextv_api.find_channels("матч")
- assert len(result) == 8
+ assert len(result) == 4
async def test_channel(yandextv_api: YandexTvApi):
- result = await yandextv_api.get_channel_schedule("test", datetime.date.today())
+ result = await yandextv_api.get_schedule("test", datetime.date.today())
assert result is not None
assert len(result.values) > 0