Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

有没有考虑过支持阅读APP的书源? #8

Closed
qiqbaba opened this issue Apr 23, 2024 · 16 comments
Closed

有没有考虑过支持阅读APP的书源? #8

qiqbaba opened this issue Apr 23, 2024 · 16 comments

Comments

@qiqbaba
Copy link

qiqbaba commented Apr 23, 2024

https://github.com/gedoor/legado

感觉还是阅读用的人更多吧(实际上我也不知道)

@aooiuu
Copy link
Owner

aooiuu commented Apr 23, 2024

JAVA代码的规则兼容不好实现

@Knightwood
Copy link

阅读的书源规则似乎也是JSONPath,XPath那些( https://mgz0227.github.io/The-tutorial-of-Legado/Rule/source.html@aooiuu

@aooiuu
Copy link
Owner

aooiuu commented Apr 26, 2024

阅读的书源规则似乎也是JSONPath,XPath那些( https://mgz0227.github.io/The-tutorial-of-Legado/Rule/source.html@aooiuu

工作量还是有点大。

@mabDc
Copy link

mabDc commented May 2, 2024

用的人多不多不是问题,问题是实际能用书源够不够多。
无论如何,支持阅读书源导入是一回事,实际能不能工作又是一回事,感觉是大部分无法工作,因为阅读自己尝试移植其他平台也失败。
欢迎讨论。@Knightwood @qiqbaba 我以为适配没法做到丝毫不改阅读书源。

@Knightwood
Copy link

用的人多不多不是问题,问题是实际能用书源够不够多。
无论如何,支持阅读书源导入是一回事,实际能不能工作又是一回事,感觉是大部分无法工作,因为阅读自己尝试移植其他平台也失败。
欢迎讨论。@Knightwood @qiqbaba 我以为适配没法做到丝毫不改阅读书源。

不,这不是一回事,阅读要移植其它平台,安卓原生开发没法跨平台,ios那些平台不用java,所以,移植得重写所有东西,linux或win能用java,但ui又不通用,所以至少ui相关都要重写。如果它一开始用的是compose或flutter,移植就会容易很多。

@mabDc
Copy link

mabDc commented May 2, 2024

用的人多不多不是问题,问题是实际能用书源够不够多。
无论如何,支持阅读书源导入是一回事,实际能不能工作又是一回事,感觉是大部分无法工作,因为阅读自己尝试移植其他平台也失败。
欢迎讨论。@Knightwood @qiqbaba 我以为适配没法做到丝毫不改阅读书源。

不,这不是一回事,阅读要移植其它平台,安卓原生开发没法跨平台,ios那些平台不用java,所以,移植得重写所有东西,linux或win能用java,但ui又不通用,所以至少ui相关都要重写。如果它一开始用的是compose或flutter,移植就会容易很多。

耦合度太高,没法支持它的特性,他没有标准规范,阅读2的规则支持度高一些。你多看看书源写法,很多符号含义不一样,甚至很多版本更新只为了某个书源写法,它的解码方法多到凌乱,相互重复可以替代的方法很多。或许你认为的支持就是不包含js方法部分,我是觉得没有那些js方法,支持也没意义,如果支持js方法,那就不是阅读的事情了,在js里对http请求和编码解码,和同步异步问题,这个any-reader是原生支持js特性的,他直接用es规范的fetch异步来做,这是正常而合理的。我觉得js部分存在根本的矛盾,所以不支持。至于很多app所谓支持阅读都是虚有其表,支持度如果量化,很多不到50%,最后是只用现在的功能完善已经有几千个源可用。

举例的xpath写法和jsonpath写法在any-reader本来就支持,那是有规范的。不必担心这一点。


仍可商榷。作者保重身体,加油更,期待。

@mabDc
Copy link

mabDc commented May 2, 2024

阅读的书源规则似乎也是JSONPath,XPath那些( https://mgz0227.github.io/The-tutorial-of-Legado/Rule/source.html@aooiuu

工作量还是有点大。

jsonpath和xpath部分any-reader已然支持,我以为问题不在此处。

@mabDc
Copy link

mabDc commented May 2, 2024

书源举例。不晓得怎样才能支持。觉得没戏

Screenshot_2024-05-02-14-42-30-100_io.legado.app.release.jpg

@aooiuu
Copy link
Owner

aooiuu commented May 5, 2024

书源举例。不晓得怎样才能支持。觉得没戏

大佬,就等你先支持了 然后我来抄下作业

@mabDc
Copy link

mabDc commented May 5, 2024

书源举例。不晓得怎样才能支持。觉得没戏

大佬,就等你先支持了 然后我来抄下作业

我是指这个书源根本不可能搞定(觉得有什么误会

<js>
 loadDocType="{{@@body@data-doctype}}";
 loadType="{{@@body@data-randomtype}}";
sid=baseUrl.match(/(\d+).html/)[1];
url=baseUrl.replace(/\d+.html/,'')

var section = {
    loadDocType: loadDocType,
    loadType: loadType,
    sid:sid,
    content: {
        childNode: [],
        
        init: function(c){
            this.body=c
            if (section.loadType == 'normal') {
      this.load(String(java.base64Decode(java.getString('//*[@name="client"]/@content'))))
            } else if (section.loadType == 'substep') {
                var d = 'r' + section.sid;
                var f = false;
                if (section.loadDocType == 'xml') {
                    d += '.xml'
                } else if (section.loadDocType == 'json') {
                    d += '.json';
                    f = true
                } else {
                    return false
                };        
             cookie="PHPSESSID="+java.get(baseUrl,{}).cookie("PHPSESSID");
            token= java.get(url+d,{"X-Requested-With": "XMLHttpRequest","referer":baseUrl,"cookie":String(cookie)}).header("token")                
                	this.load(token)      	
            } else {
                return false
            };               
        },
        load: function(a) {         
            a = String(java.base64Decode(a)).split(/[A-Z]+%/);      
            var b = 0,
            start = 0;
            for (var i = 0; i < this.body.length; i++) {
                if (String(this.body[i]).match(/h2/i)) {
                    start = i + 1
                };
                if (String(this.body[i]).match(/div/i)&& this.body[i].attr("class") != 'chapter') {
                    break
                }
            };
          
            for (var i = 0; i < a.length; i++) {
                if (a[i] < 5) {
                    this.childNode[a[i]] = this.body[i + start];
                      b++
                } else {
                    this.childNode[a[i] - b] = this.body[i + start]                 
                }
            };
  }
}
}
section.content.init(java.getElement("@@id.content@children!0").toArray());
section.content.childNode.join("")
</js>
tag.div@ownText

@aooiuu
Copy link
Owner

aooiuu commented May 5, 2024

section

感觉可以注入JS, 去实现一些JAVA方法

比如注入JS

var java = {}
java.base64Decode =  () => {} // JS模拟具体实现

即使这样,工作量依旧巨大。

@mabDc
Copy link

mabDc commented May 5, 2024

自然可以,这是类似于『环境模拟』,比如常见的模拟『webview环境』,增加一个window对象window=globalThis,可以学学下划线那个js库的写法

@aooiuu
Copy link
Owner

aooiuu commented Jul 27, 2024

阅读3解析库分支: https://github.com/aooiuu/any-reader/tree/legado

不定期开发。

感兴趣的可以一起参与开发。

@821938089
Copy link
Contributor

821938089 commented Aug 3, 2024

这个书源还是有可能搞定的,只不过会很麻烦:
1.异步问题解决方案 https://github.com/abbr/deasync
https://stackoverflow.com/a/27641505/22258653
2.剩下的问题就是模拟环境了

@821938089
Copy link
Contributor

阅读规则中的json可能是不标准的格式,用这个库应该可以修复
https://www.npmjs.com/package/jsonrepair

@aooiuu
Copy link
Owner

aooiuu commented Aug 17, 2024

阅读规则中的json可能是不标准的格式,用这个库应该可以修复 https://www.npmjs.com/package/jsonrepair

这个不错,感觉可以在后面导入规则时用这个库转换成标准json

Repository owner locked and limited conversation to collaborators Sep 13, 2024
@aooiuu aooiuu converted this issue into discussion #141 Sep 13, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

5 participants