gpt4 book ai didi

Java Goose 不在 Android 上提取内容

转载 作者:行者123 更新时间:2023-11-30 02:46:10 26 4
gpt4 key购买 nike

我正在尝试设置一个小型 Android 应用程序,它使用 Goose 库从网页中提取内容。由于该库是用 Scala 编写的,我使用的是我找到的 .jar here .问题是,当我尝试从页面中提取内容时,它什么也没有返回。我使用我需要的 URL 成功创建了一个 Article 对象,但是该对象的值(标题、域、topImage 等)都是 null。我尝试使用不同的 url,以查看问题是否与单个网站有关,但似乎并非如此。

我用来设置 Goose 实例的代码是这样的:

gooseDir = context.getCacheDir();
Configuration config = new Configuration();
config.setLocalStoragePath(gooseDir.getAbsolutePath());
Goose goose = new Goose(config);

然后我像这样创建 Article 实例:

Article article = goose.extractContent(url);

有什么建议吗?

最佳答案

实际上,由于不兼容,您无法在 Android 上使用 Goose 库,但您可以使用我的 Android 版本:https://github.com/milosmns/goose

它的功能与 Goose 几乎相同,只是在 Android 上运行良好。

关于Java Goose 不在 Android 上提取内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24978300/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com