Open skarekrow opened 4 years ago
I also tagged https://github.com/animetosho on their sites feedback to see if it's something they can tackle on their end.
I investigated this a little. From what I can tell, I think the issue is that Medusa ignores supplied URL parameters and just forces /api to the end of the URL.
In other words, if you supply http://example.com/api?param=value
, Medusa forcibly rewrites it to http://example.com/api
, throwing away the query parameter. Similarly, http://example.com/newznab_api
also gets rewritten to http://example.com/api
which means that an indexer can't even work around the issue easily by supplying a second endpoint.
My recommendation would be to fully support querying via the supplied URL as written. If supporting URL parameters would be difficult, at the very least respect custom paths given by the user and not forcibly rewrite them (i.e. handle http://example.com/newznab_api
).
For background, Anime Tosho supplies two enclosures via it's /api endpoint, differentiated by MIME type. I'm guessing Medusa doesn't try to distinguish between the two by checking MIME, and just uses the first reference (which happens to be torrent). As many clients do this, there's a workaround, via extra parameter, to get the API to only send back the correct enclosure, however this won't work if there's no way to pass that information onto the endpoint.
Thanks for the clarification! We can indeed add the MIME type check. It's already being done in some other places and should be easy to add.
In the meantime, a quick dirty fix at https://github.com/pymedusa/Medusa/blob/d0c136d7a528a471b51676140bd35d24d97f65c6/medusa/providers/nzb/newznab.py#L169
if 'tosho' in self.url:
response = self.session.get(urljoin(self.url, 'api?only_nzb=1'), params=search_params)
else:
response = self.session.get(urljoin(self.url, 'api'), params=search_params)
does the job for now for anybody waiting for the MIME type check, tested it does indeed send an nzb to sab 👍
AnimeTosho seems to use a different dual type of newznab/torznab provider that includes torznab in the description tags despite asking for just NZB's, so Medusa will have to do some gymnastics to properly parse this.
Currently it see's releases, but sends torrents to the NZB client. More details here:https://www.reddit.com/r/PyMedusa/comments/e7kyoc/issues_with_a_dual_newznabtorznab_provider/