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

翻译返回结果变的只有一条了 #125

Open
ChenLeoXX opened this issue Apr 26, 2024 · 8 comments
Open

翻译返回结果变的只有一条了 #125

ChenLeoXX opened this issue Apr 26, 2024 · 8 comments

Comments

@ChenLeoXX
Copy link

有人遇到吗

@paddy-w
Copy link

paddy-w commented May 3, 2024

感觉是有道的 api 变了

@williambao
Copy link

同样

@VWagen1989
Copy link

+1

@VWagen1989
Copy link

VWagen1989 commented May 19, 2024

看了下有道 API 返回的结果,确实改变了。从当前 workflow 的代码看,以前那些翻译条目都在一个叫 "basic" 的条目下面。现在已经没有了。我注意到有个 "webdict" 的条目。发了个请求得到了一个 html 响应。里面正有我们需要的那些翻译结果。所以我搞了个临时方案,改了一下这个 workflow 实际调用的 "index.js" 脚本来适配新的 API。暂时解决了。。

新的脚本在这里(github 不能发 .js 后缀的文件,所以我加了个 .txt 后缀。各位下载之后自己去掉 .txt 后缀再用吧):
index.js.txt

具体操作流程如下:

  • 没有安装 nodejs 的先在自己电脑里安装 nodebrew install node
  • 然后用 npm 安装这个依赖:cheerio(为了方便解析 html 内容,就装了这个依赖)。npm install cheerio
  • 接下来,定位到 workflow 的文件夹,并替换掉 index.js 文件。如图:
image image
  • 最后,修改一下脚本运行的命令,改为本机 nodejs(以前用的 txiki,引入依赖有点麻烦,所以改用 nodejs)。如图:
image image

大功告成!祝玩得开心!

image image

@YonkaFang
Copy link

YonkaFang commented May 21, 2024

@VWagen1989

感谢,方便提个PR吗?

@VWagen1989
Copy link

VWagen1989 commented May 21, 2024

@VWagen1989

感谢,方便提个PR吗?

本来想提 PR 的,但是没看到这个项目里哪个文件生成的 index.js... ¯\(ツ)

@YonkaFang
Copy link

@VWagen1989
感谢,方便提个PR吗?

本来想提 PR 的,但是没看到这个项目里哪个文件生成的 index.js... ¯_(ツ)_/¯

仔细看了下,你的图好像是wenson那个项目的workflow修改 😂

@VWagen1989
Copy link

VWagen1989 commented May 21, 2024

@VWagen1989
感谢,方便提个PR吗?

本来想提 PR 的,但是没看到这个项目里哪个文件生成的 index.js... ¯_(ツ)_/¯

仔细看了下,你的图好像是wenson那个项目的workflow修改 😂

还真是,搞混了。。😅 有空我再提个 PR 吧。不过我的实现方式太过 tricky,看看大佬接不接收吧。

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

5 participants