用 bash 抓取网页如何编写脚本 [英] Web scraping with bash how to write script

查看:31
本文介绍了用 bash 抓取网页如何编写脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 bash https://www.mcdelivery 进行网页抓取.com.pk/pk/browse/menu.html 并过滤左侧的菜单以显示交易名称和价格.我需要帮助,请让我知道如何编写 bash 脚本来获取交易的名称和价格.提前致谢

I am trying to webscrape with bash https://www.mcdelivery.com.pk/pk/browse/menu.html and filter the menu on the left to display the deal name and price. I need help please let me know how to write a bash script to get the name and price of the deals. Thanks in advance

推荐答案

使用 sed 来 grep html 文件的名称和价格.每个交易名称都包含在类 product-titleh5 元素中,每个价格都包含在类 span 元素中起始价格.查看有关此答案 [1] 的一些示例,这应该会让您有所了解.

Use sed to grep the html file for the names and prices. Every deal name is enclosed in an h5 element with class product-title, and every price is enclosed in a span element with class starting-price. Look through some examples on this answer [1], and that should get you going.

[1] 提取部分代码并在 bash 中解析 HTML

这篇关于用 bash 抓取网页如何编写脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆