mirror of
https://github.com/g0ldyy/comet.git
synced 2026-01-12 01:16:12 +01:00
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:
@@ -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()
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user