实用脚本:电影信息查询、货币换算、股票跟踪与网页变更监控
在互联网时代,我们常常需要从网络上获取各种信息,如电影信息、货币汇率、股票价格以及网页变更情况等。本文将介绍几个实用的脚本,帮助你更高效地完成这些任务。
1. 从 IMDb 挖掘电影信息
1.1 脚本功能
该脚本可以通过搜索互联网电影数据库(IMDb,http://www.imdb.com/)来查找符合指定模式的电影。它能够处理两种不同格式的返回信息:如果搜索模式匹配到多部电影,脚本将返回可能的电影标题列表;如果只匹配到一部电影,则返回该电影的详细信息。
1.2 代码实现
#!/bin/sh
# moviedata - Given a movie title, returns a list of matches, if
# there's more than one, or a synopsis of the movie if there's
# just one. Uses the Internet Movie Database (imdb.com).
imdburl="http://us.imdb.com/Tsearch?restrict=Movies+only&title="
titleurl="http://us.imdb.com/Title?"
tempout="/tmp/moviedata.$$"
summarize_film()
{
# Produce an attractive synopsis of the film
grep "^<title>" $tempout
超级会员免费看
订阅专栏 解锁全文
4490

被折叠的 条评论
为什么被折叠?



