[vlc-devel] [PATCH] Fix bug with VLSub '401 Unauthorized' error

Alon Sirota sirotaalon at gmail.com
Sat Aug 15 07:50:14 CEST 2020


Using the 'LogIn' XML-RPC with a none-English language results in no
subtitles being listed and an error message: "Error: code '401
Unauthorized (200)'".

Problem:
'LogIn' RPC is requested with the 'language' as the 'useragent'
parameter,
api.opensubtitles.org replies with '414 Unkown User Agent' error
instead of the expected session token,
'SearchSubtitles' RPC is requested with an empty session token,
api.opensubtitles.org replies with '401 Unauthorised' error instead
of the expected listing of subtitles.

Solution: reorder the parameters in the 'LogIn' call to meet with the API
documented in:
https://trac.opensubtitles.org/projects/opensubtitles/wiki/XMLRPC#LogIn
which specifies: LogIn( $username, $password, $language, $useragent )
Notice how $language and $useragent were out of order.

Steps to reproduce bug:
1) Open any video file with vlc
2) Open VLSub extension
3) Select 'Hebrew' from the 'Subtitles language:' dropdown menu
4) Click 'Search by hash' or 'Search by name'
---
 share/lua/extensions/VLSub.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua
index 2edc73ecdc..85c14f09d0 100644
--- a/share/lua/extensions/VLSub.lua
+++ b/share/lua/extensions/VLSub.lua
@@ -1113,8 +1113,8 @@ openSub = {
         return {
           { value={ string=openSub.option.os_username } },
           { value={ string=openSub.option.os_password } },
-          { value={ string=openSub.conf.useragent } },
           { value={ string=openSub.movie.sublanguageid } },
+          { value={ string=openSub.conf.useragent } },
         }
       end,
       callback = function(resp)
-- 
2.28.0



More information about the vlc-devel mailing list