简体   繁体   English

如何使用Shell脚本读取/搜索网页中的特定内容

[英]How to read/search specific content in a webpage using shell scripting

I'm a beginner in shell scripting. 我是shell脚本的初学者。

I'm trying to write a script in which a part of it involves reading the value from a webpage. 我正在尝试编写一个脚本,其中一部分涉及从网页中读取值。 In this case, The shell script tries to fetch the IMDB rating of a movie by going to the movie's IMDB page. 在这种情况下,shell脚本会通过转到电影的IMDB页面来尝试获取电影的IMDB等级。

Can someone suggest me how i can achieve this & also what are the topics i need to learn ? 有人可以建议我如何实现这一目标,还需要学习哪些主题?

Thank you. 谢谢。

You can use wget and curl to get the page. 您可以使用wget和curl来获取页面。 Then you'll need to use regex or some other string manipulation to get the information you need from that. 然后,您将需要使用正则表达式或其他字符串操作来从中获取所需的信息。 It would be a lot easier to use a library to do some of these things for you. 使用为您完成其中一些操作会容易得多。

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

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