refactor: enhance ID handling in StremthruScraper

- Updated the StremthruScraper to utilize the anime_mapper for retrieving IMDb IDs from Kitsu, improving the accuracy of media ID handling.
- Adjusted the API request to use the mapped IMDb ID when available, ensuring better integration with the anime service.
This commit is contained in:
g0ldyy
2025-12-10 19:15:35 +01:00
parent 7f5a0b87f2
commit cc83fa588e
2 changed files with 11 additions and 2 deletions
+8 -1
View File
@@ -5,6 +5,7 @@ import aiohttp
from comet.core.logger import log_scraper_error, logger
from comet.scrapers.base import BaseScraper
from comet.scrapers.models import ScrapeRequest
from comet.services.anime import anime_mapper
class StremthruScraper(BaseScraper):
@@ -15,8 +16,14 @@ class StremthruScraper(BaseScraper):
torrents = []
try:
media_id = request.media_only_id
if "kitsu" in request.media_id:
imdb_id = anime_mapper.get_imdb_from_kitsu(int(media_id))
if imdb_id:
media_id = imdb_id
data = await self.session.get(
f"{self.url}/v0/torznab/api?t=search&imdbid={request.media_only_id}"
f"{self.url}/v0/torznab/api?t=search&imdbid={media_id}"
)
data_text = await data.text()
+3 -1
View File
@@ -237,7 +237,9 @@ class AnimeMapper:
except asyncio.CancelledError:
raise
except Exception as exc:
logger.warning(f"Anime mapping refresh loop encountered an error: {exc}")
logger.warning(
f"Anime mapping refresh loop encountered an error: {exc}"
)
async def stop(self):
if self._background_task: