✨ 初始提交:月读第三方书源插件集合
每个书源一个独立插件目录,含微信读书公众号订阅、书架导入等完整功能。 Co-authored-by: Copilot <[email protected]>
This commit is contained in:
commit
9190db9019
38 files changed
+5783
No files matched your search
@@ -0,0 +1,32 @@
|
||||
--[[--
|
||||
番茄网页榜单解析离线用例:内嵌状态(含裸 undefined)、PUA 书名解码、封面。
|
||||
|
||||
@module tests.moonsource_fanqie.rank_spec
|
||||
--]]
|
||||
---@diagnostic disable: undefined-field, missing-fields, redundant-parameter, missing-parameter, inject-field, assign-type-mismatch, param-type-mismatch, cast-type-mismatch, return-type-mismatch, cast-local-type
|
||||
|
||||
local Assert = require("support.assert")
|
||||
local JSONStub = require("support.json_stub")
|
||||
|
||||
package.preload["json"] = function()
|
||||
return { decode = JSONStub.decode, encode = JSONStub.encode }
|
||||
end
|
||||
package.loaded["moonsource_fanqie.rank"] = nil
|
||||
local Rank = require("moonsource_fanqie.rank")
|
||||
|
||||
local html = '<script>(function(){window.__INITIAL_STATE__={"rank":{"book_list":[{"bookId":"7654593151348247614",'
|
||||
.. '"bookName":"\u{E4C2}\u{E3E9}诡异","author":"糕","abstract":"\u{E3E9}简介","pos_category_id":undefined,'
|
||||
.. '"thumbUri":"https://p3-reading-sign.fqnovelpic.com/novel-pic/abc~tplv-resize:225:0.image?x=1"}],'
|
||||
.. '"rankCategoryTypeList":{"male":[{"id":"1141","name":"西方奇幻"}],"female":[]}}};\n})()\n</script><script>x</script>'
|
||||
|
||||
do
|
||||
local rank = Rank.state(html)
|
||||
Assert.eq(rank.rankCategoryTypeList.male[1].name, "西方奇幻")
|
||||
local books = Rank.books(rank, "ext.fanqie")
|
||||
Assert.len(books, 1)
|
||||
Assert.eq(books[1].stable_id, "7654593151348247614")
|
||||
Assert.matches(books[1].title, "在诡异$")
|
||||
Assert.eq(books[1].intro, "在简介")
|
||||
Assert.matches(books[1].cover, "novel%-pic/abc")
|
||||
Assert.is_nil(Rank.state("<html>人机验证</html>"))
|
||||
end
|
||||
Reference in new issue
Block a user