百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 文章教程 > 正文

分享一段源码挖掘IMDb电影信息_电影搜索引擎源码

yund56 2025-02-25 00:41 15 浏览

Python能抓取网页上的信息,当然bash也可以,今天小编就拿bash脚本来挖掘IMDb中的电影信息噢!!挺好玩的!!!

我们是做教育的,希望大家能够学到知识,这个一直是我们的初衷!!

电影网站https://www.imdb.com,这个网站我自己登入上去看了看,确实可以登入,并不需要挂vpn,可惜的是英文。

因为代码太长了,我分屏了一下,大伙可以看行号码,不过我会把源码分享出去。

代码里用到了大量的sed和grep,这个sed我之前有分享,改天找个机会说说grep的使用。

写好了运行一下吧,在脚本后面lawrence of arabia是电影的名字。

你看吧!出来一系列的电影了!当然你的英文要好!!

那我现在就分享一下代码吧!!

#!/bin/bash
#Date 2019-09-17
PATH=/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
 
titleurl="http://www.imdb.com/title/tt"
imdburl="http://www.imdb.com/find?s=tt&exact=true&ref_=fn_tt_ex&q="
tempout="/tmp/moviedata.$$"
 
summarize_film()
{
 grep "" $tempout | sed 's/<[^>]*>//g;s/(more)//'
 grep --color=never -A2 '<h5>Plot:' $tempout | tail -1 |\
 cut -d\ -f1 | fmt | sed 's/^/ /'
 exit 0
}
trap "rm -f $tempout" 0 1 15
 
if [ $# -eq 0 ] ; then
 echo "Usage:$0 {movie title | movie ID}" >&2
 exit 1
fi
######
 
nodigits="$(echo $1 | sed 's/[[:digit:]]*//g')"
 
if [ $# -eq 1 -a -z "$nodigits" ] ;then
 lynx -source "$titleurl$1/combined" > $tempout
 summarize_film
 exit 0
fi
########
 
fixedname="$(echo $@ | tr ' ' '+')"
url="$imdburl$fixedname"
lynx -source $imdburl$fixedname > $tempout
 
fail="$(grep --color --color=never '<h1 class="findHeader">No ' $tempout)"
 
if [ ! -z "$fail" ] ;then
 echo "Failed:no results foun for $1"
 exit 1
elif [ ! -z "$(grep '<h1 class="findHeader">Displaying' $tempout)" ] ;then
 grep --color=never '/title/tt' $tempout | \
 sed 's/</\
 </g' | \
 grep -vE '(.png|.jpg|>[ ]*$)' |\
 grep -A 1 "a href=" | \
 grep -v '^--$' | \
 sed 's/<a href="\/title\/tt//g;s/<\/a>//' | \
 awk '(NR %2 ==1){title=$0} (NR %2 ==0){print title " " $0}' | \
 sed 's/\/.*>/: /'|\
 sort
fi
exit 0
</pre><p>大家可以复制下来运行一下,不懂的话直接私信小编,或者加群讨论!!一起学习一起进步!!!</p><p>我们是做教育的,希望大家能够学到知识,这个一直是我们的初衷!!</p><p>记住噢,加群讨论噢,不懂的可以问,也有人回答的。</p></div></div>

<div class="clearfix mb10">
        <div class="share fr">
        <div class="social-share mb20 ta-c" data-initialized="true">
            <a href="#" class="social-share-icon iconfont icon-weibo"></a>
            <a href="#" class="social-share-icon iconfont icon-qq"></a>
            <a href="#" class="social-share-icon iconfont icon-wechat"></a>
            <a href="#" class="social-share-icon iconfont icon-qzone"></a>
        </div>
        <script src="http://www.yund56.com/zb_users/theme/tx_hao/script/social-share.min.js"></script>
    </div>
    
        <div class="info-tag">
        <a href="http://www.yund56.com/tags-4.html" title="查看更多影视网站免费源码最新版内容" rel="tag" target="_blank">影视网站免费源码最新版</a>    </div>
    </div>



<div class="info-next">
    <ul class="row">
        <li class="col-12 col-m-24 mb10">上一篇:<a href="http://www.yund56.com/post/166.html" title="人人影视:二十年全部字幕文件及数据开源分享">人人影视:二十年全部字幕文件及数据开源分享</a></li>
        <li class="col-12 col-m-24 ta-r mb10">下一篇:<a href="http://www.yund56.com/post/168.html" title="人人影视宣布开源全部字幕文件及数据">人人影视宣布开源全部字幕文件及数据</a></li>
    </ul>
</div>

            </div>
            <h2 class="tx-title">相关推荐</h2>
            <div class="home-news">
                                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3611.html" title="没有获得Windows 10 20H2升级通知,怎样直接升级" class="f-black" target="_blank">没有获得Windows 10 20H2升级通知,怎样直接升级</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">微软公司已经正式发布Windows1020H2操作系统,在正常情况下,微软只会首先推送到少量电脑,然后一边推送一边采集遥测数据。收集遥测数据可以确定哪些电脑可以更新,哪些电脑在更新后可能会失败,微...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3610.html" title="不想让人随便卸载你安装的程序,用这四招,他将无计可施" class="f-black" target="_blank">不想让人随便卸载你安装的程序,用这四招,他将无计可施</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">Windows10不提供设置删除应用程序限制的功能,有几种间接方法可以防止用户删除操作系统中的程序和游戏。一、WindowsInstaller服务使用Windows工具,可以部分限制用户的权限。如...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3609.html" title="一文看懂苹果全球开发者大会 五大系统全面升级" class="f-black" target="_blank">一文看懂苹果全球开发者大会 五大系统全面升级</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">来源:环球网【环球网智能报道记者张阳】北京时间6月23日凌晨1点,苹果全球开发者大会(WWDC2020)如期举行,还是那个熟悉的乔布斯剧院,依旧是高水准的视频展示,但是这届WWDC,却是苹果历史...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3608.html" title="无需等待微软分批推送,23H2可借助注册表快速获取Win11 24H2更新" class="f-black" target="_blank">无需等待微软分批推送,23H2可借助注册表快速获取Win11 24H2更新</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">IT之家10月15日消息,Windows1124H2正在分批推送,但由于存在多种Bug,微软已经开始放缓其推送节奏。WindowsLatest发现,Windows1123H2...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3607.html" title="办公小技巧:剑走偏锋 PPT中打造动态图表" class="f-black" target="_blank">办公小技巧:剑走偏锋 PPT中打造动态图表</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">年底到了少不了又要制作各种总结报表,为了让自己的报表与众不同,我们可以借助PowerPoint动画组件+报表的方式,打造出更为出彩的动态图表。下面以PowerPoint2016为例,介绍如何使用三维...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3606.html" title="文档表格 版本差异何在" class="f-black" target="_blank">文档表格 版本差异何在</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">在办公过程中,对文档或表格的修改是司空见惯的事。那么,一份文档做了内容改动,如何知道差异在哪里?一份表格改动部分数据,如何知道哪些有所变动?不要说审阅和修订功能,因为不是所有人都会用这些功能来标注的,...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3605.html" title="Excel VBA自制日历组件16色可选 完美替代VBA日期控件" class="f-black" target="_blank">Excel VBA自制日历组件16色可选 完美替代VBA日期控件</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">本日期组件可跟随单元格跟随窗体中ActiveX文本框组合框控件16种配色可选私信回复880日历可体验效果使用说明1打开自己需要应用日历面板的Excel表,注意必须是启用VBA的格式2在...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3604.html" title="如何从交互角度读懂产品需求文档" class="f-black" target="_blank">如何从交互角度读懂产品需求文档</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">作为设计师,理解产品经理提供的需求文档是交互设计工作的重要前提与起点,然而对于很多设计师来说,需求文档内容通常非常复杂,设计师们需要花费大量时间去消化、理解和归纳。本文作者结合公司示例,分析设计师如何...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3603.html" title="植入让文档变得更强大" class="f-black" target="_blank">植入让文档变得更强大</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">有效地利用文档置入技术,会让我们的常用文档功能变得更加强大,实现更加高效或有趣的应用。1.写字板文档嵌入其他文档有时,我们要组织一个大型的文档,但是这些文档的内容可能来自于不同种类的文档编辑器,比如...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3602.html" title="Office 2016滚动文本框 顺手就来" class="f-black" target="_blank">Office 2016滚动文本框 顺手就来</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">【电脑报在线】如果一页PPT内容较多无法在完全显示,就需要用到滚动文本框,在PPT2016中借助控件即可快速制作滚动文本框。在“告诉我你想要做什么”输入“文本框控件”,在搜索结果点击“文本框(Acti...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3601.html" title="Axure的多状态复选树" class="f-black" target="_blank">Axure的多状态复选树</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">本文将详细介绍如何在Axure中实现一种增强型的多状态复选树组件,它不仅支持全选、半选和未选等状态,还具备动态加载、关键字筛选等高级功能。多状态复选树(Multi-StateCheckboxTre...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3600.html" title="办公小技巧:PPT中控件图表巧联动" class="f-black" target="_blank">办公小技巧:PPT中控件图表巧联动</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">在利用PPT进行图表演示时,操作者有可能要与图表进行交互联动,比如通过输入数据来预测产品的生产情况等,这时就需要用到“开发工具”中的控件了。几个控件配合几句VBA代码,就可以轻松实现上述交互联动效果(...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3599.html" title="用好插件——找回火狐的旧功能" class="f-black" target="_blank">用好插件——找回火狐的旧功能</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">现在的软件,特别是浏览器类软件,更新换代速度都很快,而且无论是外观界面还是系统组件都会有较大的变化,这样会让很多朋友无所适从。以大家常用的火狐浏览器为例,它就已经升级到了最新的35版,而且在新版中对很...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3598.html" title="重新认识控件(二)" class="f-black" target="_blank">重新认识控件(二)</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">图片和文字,都是一种数据形式。我平时对文本框的录入,报错和提交的设计比较多。最近涉及到图片控件的设计,细细琢磨一下,这玩意还有一些平时没太注意的细节点,感觉对于其他控件的设计有指导意义,特此总结一下传...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.yund56.com/post/3597.html" title="JSA宏教程——在文档中添加复合框控件" class="f-black" target="_blank">JSA宏教程——在文档中添加复合框控件</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">上一期,我们初步认识了控件Control,本节我们将继续控件的相关内容。这几期我们将逐一介绍相关控制。本节先介绍复合框(也叫组合框)Combobox。复合框的作用复合框就是一个下拉选项框,一次显示一个...</p>
    </dd>
    </dl>                
            </div>

            
        </div>

                <div class="side-box col-6 col-m-24 col2-">
                                    <dl class="side-hot">
                <dt>一周热门</dt>
                <dd>
                    <ul>
                                                <li>
                            <a href="http://www.yund56.com/post/257.html" title="django留言板_留言板html好看的模板" target="_blank">
                                                                <h2 class="f-15">django留言板_留言板html好看的模板</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/1654.html" title="一次分享给你29个PHP基础常用类助力你快速提升" target="_blank">
                                                                <h2 class="f-15">一次分享给你29个PHP基础常用类助力你快速提升</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/107.html" title="你还在手动筛选吗?filter函数才是多条件筛选的yyds!" target="_blank">
                                                                <h2 class="f-15">你还在手动筛选吗?filter函数才是多条件筛选的yyds!</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/108.html" title="一篇文章轻松掌握VLookup、XLookup与Filter函数" target="_blank">
                                                                <h2 class="f-15">一篇文章轻松掌握VLookup、XLookup与Filter函数</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/820.html" title="软件工程培训,选择线上还是线下呢?" target="_blank">
                                                                <h2 class="f-15">软件工程培训,选择线上还是线下呢?</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/825.html" title="连南举办2024年软件正版化工作联席会议暨正版软件培训班" target="_blank">
                                                                <h2 class="f-15">连南举办2024年软件正版化工作联席会议暨正版软件培训班</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/1653.html" title="初学ThinkPHP(一):用TP6+LayUI实现数据表格" target="_blank">
                                                                <h2 class="f-15">初学ThinkPHP(一):用TP6+LayUI实现数据表格</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/70.html" title="Excel筛选也智能?一个FILTER函数就搞定!" target="_blank">
                                                                <h2 class="f-15">Excel筛选也智能?一个FILTER函数就搞定!</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/75.html" title="新函数FILTER函数_filter函数的作用" target="_blank">
                                                                <h2 class="f-15">新函数FILTER函数_filter函数的作用</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.yund56.com/post/1030.html" title="营商在上海_营商上海数字科技有限公司" target="_blank">
                                                                <h2 class="f-15">营商在上海_营商上海数字科技有限公司</h2>
                            </a>
                        </li>
                                            </ul>
                </dd>
            </dl>
            
            

<dl class="function" id="divPrevious">
<dt class="function_t">最近发表</dt><dd class="function_c">


<ul><li><a title="没有获得Windows 10 20H2升级通知,怎样直接升级" href="http://www.yund56.com/post/3611.html">没有获得Windows 10 20H2升级通知,怎样直接升级</a></li>
<li><a title="不想让人随便卸载你安装的程序,用这四招,他将无计可施" href="http://www.yund56.com/post/3610.html">不想让人随便卸载你安装的程序,用这四招,他将无计可施</a></li>
<li><a title="一文看懂苹果全球开发者大会 五大系统全面升级" href="http://www.yund56.com/post/3609.html">一文看懂苹果全球开发者大会 五大系统全面升级</a></li>
<li><a title="无需等待微软分批推送,23H2可借助注册表快速获取Win11 24H2更新" href="http://www.yund56.com/post/3608.html">无需等待微软分批推送,23H2可借助注册表快速获取Win11 24H2更新</a></li>
<li><a title="办公小技巧:剑走偏锋 PPT中打造动态图表" href="http://www.yund56.com/post/3607.html">办公小技巧:剑走偏锋 PPT中打造动态图表</a></li>
<li><a title="文档表格 版本差异何在" href="http://www.yund56.com/post/3606.html">文档表格 版本差异何在</a></li>
<li><a title="Excel VBA自制日历组件16色可选 完美替代VBA日期控件" href="http://www.yund56.com/post/3605.html">Excel VBA自制日历组件16色可选 完美替代VBA日期控件</a></li>
<li><a title="如何从交互角度读懂产品需求文档" href="http://www.yund56.com/post/3604.html">如何从交互角度读懂产品需求文档</a></li>
<li><a title="植入让文档变得更强大" href="http://www.yund56.com/post/3603.html">植入让文档变得更强大</a></li>
<li><a title="Office 2016滚动文本框 顺手就来" href="http://www.yund56.com/post/3602.html">Office 2016滚动文本框 顺手就来</a></li>
</ul>

</dd>
</dl>
<dl class="function" id="divTags">
<dt class="function_t">标签列表</dt><dd class="function_c">


<ul><li><a title="filter函数js" href="http://www.yund56.com/tags-1.html">filter函数js<span class="tag-count"> (37)</span></a></li>
<li><a title="filter函数excel用不了" href="http://www.yund56.com/tags-2.html">filter函数excel用不了<span class="tag-count"> (73)</span></a></li>
<li><a title="商城开发" href="http://www.yund56.com/tags-3.html">商城开发<span class="tag-count"> (40)</span></a></li>
<li><a title="影视网站免费源码最新版" href="http://www.yund56.com/tags-4.html">影视网站免费源码最新版<span class="tag-count"> (57)</span></a></li>
<li><a title="影视资源api接口" href="http://www.yund56.com/tags-5.html">影视资源api接口<span class="tag-count"> (46)</span></a></li>
<li><a title="网站留言板代码大全" href="http://www.yund56.com/tags-6.html">网站留言板代码大全<span class="tag-count"> (56)</span></a></li>
<li><a title="java版软件下载" href="http://www.yund56.com/tags-7.html">java版软件下载<span class="tag-count"> (52)</span></a></li>
<li><a title="java教材电子课本下载" href="http://www.yund56.com/tags-8.html">java教材电子课本下载<span class="tag-count"> (48)</span></a></li>
<li><a title="java技术的电子书去哪看" href="http://www.yund56.com/tags-9.html">java技术的电子书去哪看<span class="tag-count"> (33)</span></a></li>
<li><a title="0基础编程从什么开始学" href="http://www.yund56.com/tags-11.html">0基础编程从什么开始学<span class="tag-count"> (50)</span></a></li>
<li><a title="java是用来干嘛的" href="http://www.yund56.com/tags-12.html">java是用来干嘛的<span class="tag-count"> (51)</span></a></li>
<li><a title="it入门应该学什么" href="http://www.yund56.com/tags-13.html">it入门应该学什么<span class="tag-count"> (55)</span></a></li>
<li><a title="java线上课程" href="http://www.yund56.com/tags-14.html">java线上课程<span class="tag-count"> (55)</span></a></li>
<li><a title="学java的软件叫什么软件" href="http://www.yund56.com/tags-15.html">学java的软件叫什么软件<span class="tag-count"> (38)</span></a></li>
<li><a title="程序开发软件有哪些" href="http://www.yund56.com/tags-16.html">程序开发软件有哪些<span class="tag-count"> (53)</span></a></li>
<li><a title="软件培训" href="http://www.yund56.com/tags-17.html">软件培训<span class="tag-count"> (59)</span></a></li>
<li><a title="机器人编程代码大全" href="http://www.yund56.com/tags-18.html">机器人编程代码大全<span class="tag-count"> (50)</span></a></li>
<li><a title="少儿编程教程免费" href="http://www.yund56.com/tags-19.html">少儿编程教程免费<span class="tag-count"> (45)</span></a></li>
<li><a title="新代系统编程教学" href="http://www.yund56.com/tags-20.html">新代系统编程教学<span class="tag-count"> (61)</span></a></li>
<li><a title="共创世界编程网站" href="http://www.yund56.com/tags-22.html">共创世界编程网站<span class="tag-count"> (38)</span></a></li>
<li><a title="亲测源码" href="http://www.yund56.com/tags-27.html">亲测源码<span class="tag-count"> (36)</span></a></li>
<li><a title="三角函数积分公式表" href="http://www.yund56.com/tags-29.html">三角函数积分公式表<span class="tag-count"> (35)</span></a></li>
<li><a title="函数的表示方法" href="http://www.yund56.com/tags-59.html">函数的表示方法<span class="tag-count"> (34)</span></a></li>
<li><a title="表格乘法的公式怎么设置" href="http://www.yund56.com/tags-179.html">表格乘法的公式怎么设置<span class="tag-count"> (34)</span></a></li>
<li><a title="sumif函数的例子" href="http://www.yund56.com/tags-183.html">sumif函数的例子<span class="tag-count"> (34)</span></a></li>
</ul>

</dd>
</dl>
        </div>
            </div>
</div>



</div>
<div class="footer">
    <div class="wide ta-c f-12">
                <a href="https://beian.miit.gov.cn/" target="_blank">蜀ICP备2024111239号-27</a>    </div>
</div>


<div class="fixed-box ">
    <ul>
        <li class="pchide wapflex"><a href="http://www.yund56.com/"><i class="fa fa-home"></i> 首页</a></li>
                        <li><a href="http://www.yund56.com/shoulu.html" title="收录申请" target="_blank"><i class="fa fa-chain-broken mr5"></i>收录</a></li>
                                <li><span class="gotop"><i class="fa fa-caret-up mr5"></i> 顶部</span></li>
    </ul>
</div>
<script src="http://www.yund56.com/zb_users/theme/tx_hao/script/txcstx.min.js?v=2024-12-04"></script>
</body>
</html><!--70.50 ms , 13 queries , 3288kb memory , 0 error-->