-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndexError: list index out of range #45
Comments
From what I can tell it looks like the search didn't return any items for your query, but didn't raise an error (which might be for a number of reasons. I don't remember how the api handles malformed queries). If you try the query with a hash of It's possible whatever you are trying to query for just returned no results as well. |
Thanks! I managed to get it working. I wasn't using the size variable properly. I'm trying to get subtitles for the movie Joker 2019. But it's only returning 1 subtitle. Any idea why it can only find 1? |
If you're doing a search by an exact match then it's very possible that there is only one set of subtitles associated with that exact file (the api does limit to 5 results per query if you're using the default user agent, although I can't find the docs on that now). You could also try doing a full-text search with something like: ost.search_subtitles([{"query": "Joker 2019"}]) Although this won't be as accurate as the exact match since the subtitles might not be aligned, or it may get some wrong results. Like I mentioned before this library is a very thin wrapper, so the only reason I know these things is from opensubtitles' documentation, since I've been working on my own wrapper. |
Sorry for the late reply. Your answer has been helpful and I've got it working. Do you know how to increase the limit from 5 in the API? |
It's listed here. Searches are limited to 5 results on the testing user agent which is the one that this library sets unless you provide a different value. I think 5 results are good enough for most people though, particularly when you are doing an exact file match. If you want more than 5 results you would have to register for your own user agent. |
If you want to keep asking questions then feel free to email me (It's listed under my profile). I'd rather not keep this thread going since the original issue was resolved since it can create noise for other people to sift through. |
Hi,
When I use the example provided, I get this error:
Traceback (most recent call last): File "subtitles.py", line 10, in <module> id_subtitle_file = data[0].get('IDSubtitleFile') IndexError: list index out of range
Any idea?
Thanks
The text was updated successfully, but these errors were encountered: