mirror of
https://github.com/koreader/koreader.git
synced 2026-12-02 10:12:42 +00:00
opdsbrowser: fix detecting OPDS 2.0 (#15895)
This commit is contained in:
1 parent
656cb2c27d
commit
c889c5a1de
1 file changed
+10
-9
@@ -482,15 +482,16 @@ function OPDSBrowser:parseFeed(item_url)
|
||||
else
|
||||
feed = self:fetchFeed(item_url)
|
||||
end
|
||||
local start = feed and feed:sub(1, 1)
|
||||
if start == "<" then -- OPDS 1.x
|
||||
return OPDSParser:parse(feed)
|
||||
elseif start == "{" then -- OPDS 2.0
|
||||
local JSON = require("json")
|
||||
local ret, result = pcall(JSON.decode, feed)
|
||||
if ret then
|
||||
result.is_opds2 = true
|
||||
return result
|
||||
if feed then
|
||||
if feed:match("^%s*{") then -- OPDS 2.0
|
||||
local JSON = require("json")
|
||||
local ret, result = pcall(JSON.decode, feed)
|
||||
if ret then
|
||||
result.is_opds2 = true
|
||||
return result
|
||||
end
|
||||
else -- OPDS 1.x
|
||||
return OPDSParser:parse(feed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user