使用Python查找网站中所有可能的链接/ Screen-Web抓取



这是一个开放式的问题。我需要在一个工作网站上搜索工作描述标签和技能要求(我已经完成了这个)。我基本上想知道,我如何在网站上爬行?比如,从test.com到test.com/a等等....??基本上就是抓取页面。

这是我在页面内搜索的代码。我需要在网站上找到所有可能的这样的页面,并获得链接。这不是家庭作业。我只是在旁边做这个…

import urllib2
import re
html_content = urllib2.urlopen('http://www.ziprecruiter.com/job/Systems-     Engineer/b5452eab/?source=customer-cpc-indeed').read()
matchDescription = re.findall('Bachelor', html_content);
matchSkill = re.findall('VMware', html_content);

print matchDescription
print matchSkill
if ( len(matchDescription) and len(matchSkill) )== 0: 
   print 'I did not find anything'
else:
   print 'My string is in the html'

考虑使用Scrapy或其他现有的抓取框架。否则,您需要使用lxml或其他HTML解析器手动查找必要的链接,并使用基于urllib或类似的手动机制和一些数据结构来抓取它们以存储输入和输出数据。

最新更新