Closed corwin-of-amber closed 6 years ago
I've just found the same problem too. Will you create a pull request? Do you want me to do it?
I am really wondering what changed though? Because according to the OpenSubtitles documentation it should return an "array" element in the XML-RPC response: http://trac.opensubtitles.org/projects/opensubtitles/wiki/XmlRpcSearchSubtitles
What if this is a temporary bug in the OpenSubtitles API service?
Anyway, I think it is a bit of an overkill to make a fork just for this one line temporary-or-not fix. It's all yours :)
I looked into the XML that is returned from SearchSubtitles and I can confirm that it is now a <struct>
rather than an <array>
:
<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member><name>status</name><value><string>200 OK</string></value></member>
<member>
<name>data</name>
<value>
<struct> <!-- here -->
<member>
<name>13</name>
<value>
<struct>
<member>
<name>MatchedBy</name>
<value><string>moviehash</string></value></member>
...
If it's undocumented, it stinks. I'll email Opensubtitles to make sure the change is permanent. Thanks :)
it was error from our side, sorry for that. We tried to sort accordind SCORE DESC, but it keeps indexes. Fixed.
There you have it, thank you all :)
Searching used to work flawlessly until yesterday. Then I debugged it a little and found that the response data returned from OS.SearchSubtitles (invoked in index.js:86) is no longer an array; instead it is an object with keys '0', '1', etc.
As a result, no subtitles are ever returned by OpenSubtitles.search. This is visible when observing the value returned at tests.js:34.
I am using xmlrpc@1.3.2, which seems to have not changed for two years.
When I change index.js:86 to (notice Object.values near the end of the line):
Then everything works well again.