Skip to content
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

关于牌谱屋爬虫的技术实现,有两个问题想请教 #21

Open
Sunshine40 opened this issue Jan 12, 2023 · 2 comments
Open

关于牌谱屋爬虫的技术实现,有两个问题想请教 #21

Sunshine40 opened this issue Jan 12, 2023 · 2 comments

Comments

@Sunshine40
Copy link

第一个问题,目前爬虫的实现方式,是否依赖于浏览器打开雀魂网页版实际进行观战,然后用js进行数据分析处理——也就是没法做到脱离雀魂官方(网页)客户端,独立处理观战/牌谱数据?

第二个问题,我看到本代码库当中的js源代码的编码风格,有比较明显的工具链生成痕迹,且没有看到注释,请问这些代码是通过原始代码+部署流程自动化生成的吗?请问作者是否愿意开源原始代码,以及部署(生成可执行js)的方式呢?

@SAPikachu
Copy link
Owner

  1. 現在這邊是直接連接雀魂的 WebSocket 服務器獲取數據的,不需要經過模擬瀏覽器或者客戶端。
  2. 這邊只有兩個文件是預先生成的:
    a. shanten-core.jshttps://github.com/EndlessCheng/mahjong-helper/blob/master/util/shanten_base.go 編譯而來
    b. majsoulPb.{js,d.ts} 是使用generateTsDefinition.ts從雀魂的 protobuf 定義文件majsoulPb.proto.json生成的

其它的脚本如果沒有對應的 ts 文件的話都是手寫的,不需要經過編譯步驟。ts 文件使用tsc -p tsconfig.json即可編譯成 js 文件。

@Sunshine40
Copy link
Author

現在這邊是直接連接雀魂的 WebSocket 服務器獲取數據的,不需要經過模擬瀏覽器或者客戶端。

好的,我再仔细读代码学习一下,本身我对js构建复杂业务逻辑确实不熟悉(主要是对构建第三方业务涉及的逆向工程这块有畏难情绪)

a. shanten-core.js 由 https://github.com/EndlessCheng/mahjong-helper/blob/master/util/shanten_base.go 編譯而來

难怪如此,我第一个看的就是 shanten-core.js 属于是一发出货中大奖了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants