简体   繁体   English

使用 bash 解析 HTML 片段?

[英]Parsing piece of HTML using bash?

I want to parse out the tag name (first item) from docker hub using strictly bash.我想使用严格的 bash 从 docker hub 解析出标签名称(第一项)。

Example: https://hub.docker.com/_/node?tab=tags (input)示例: https : //hub.docker.com/_/node?tab=tags (输入)

Output:输出:

latest

This image latest tag is latest whereas mine as the most recent commits (dynamic).这个图像最新标签是latest而我的是latest提交(动态)。 What is the best way to do this?做这个的最好方式是什么? I was able to use wget to store the contents into a string.我能够使用wget将内容存储到字符串中。 I see xmllint, but not quite sure how to go about it.我看到了 xmllint,但不太确定如何去做。

It is not possible to use basic tools such as wget or curl.无法使用 wget 或 curl 等基本工具。

If you disable javascript in your browser, you can see that the page have no rendering content at all.如果您在浏览器中禁用 javascript,您可以看到该页面根本没有渲染内容。

So the only one solution is to use a tool like所以唯一的解决方案是使用类似的工具 or that are javascript capable javascript 的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM