如何使用JSOUP网络刮擦Android中的动态页面
我正在尝试网络刮擦网站 savevideo.tube.tube 使用jsoup。
当我们在搜索栏中放置链接并单击搜索按钮时,网站会动态加载并显示一些我想刮擦的下载链接。我的问题是如何通过链接搜索加载JSOUP,而无需单击搜索按钮并显示结果(刮擦结果)。
有什么方法可以搜索链接并加载它而无需单击任何按钮并获得结果?
我尝试了此代码,但没有得到所需的结果。
val result:Document = Jsoup.connect(Constants.BASE_URL)
.data("url", Constants.YOUTUBE_LINK)
.data("sid", "9823478982349872384789273489238904790234")
.userAgent("Mozilla").post()
I am trying to web scrape the website savevideo.tube using JSOUP.
When we put a link in the search bar and click the search button, the website dynamically loads and shows some download links that I want to scrape. My problem is how to load link in JSOUP with the link search without clicking the search button and showing the results (scraping the results).
Is there any way to search for a link and load it without clicking any button and get results?
I tried this code but I'm not getting the required result.
val result:Document = Jsoup.connect(Constants.BASE_URL)
.data("url", Constants.YOUTUBE_LINK)
.data("sid", "9823478982349872384789273489238904790234")
.userAgent("Mozilla").post()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
jsoup是静态HTML 解析器。您无法动态地解析JavaScript加载的内容。为此,您必须使用Web驱动器。
您可以使用的最佳网络驱动器是
您也可以使用硒,但它可能不是 android 的理想选择
: -
JSOUP is a Static HTML parser. You cannot parse the content that is loaded by javascript dynamically. For that, you have to use a web drive.
The best web drives that you can use are
You can also use selenium but it may not be ideal for android
:-
如ʀᴀʜɪʟ所述,JSOUP仅是静态HTML解析器。如果您想刮擦使用JS生成内容的网站,则可能应该查看 skrape.it 库
As mentioned by ʀᴀʜɪʟ, JSOUP is a static HTML parser only. If you want to scrape a website that uses JS generated content you should probably take a look at skrape.it library