我已经尝试写这个蜘蛛好几个星期了,但没有成功。我用 Python 编写代码的最佳方法是什么:
1)初始网址:http://www.whitecase.com/Attorneys/List.aspx?LastName=A
2) 从初始 url 中使用这个正则表达式获取这些 url:
hxs.select('//td[@class="altRow"][1]/a/@href').re('/.a\w+')
[u'/cabel', u'/jacevedo', u'/jacuna', u'/aadler', u'/zahmedani', u'/tairisto', u
/zalbert', u'/salberts', u'/aaleksandrova', u'/malhadeff', u'/nalivojvodic', u'
....
3) 转到这些网址中的每一个并使用此正则表达式刮取学校信息
hxs.select('//td[@class="mainColumnTDa"]').re('(?<=(JD,\s))(.*?)(\d+)'
[u'JD, ', u'University of Florida Levin College of Law, <em>magna cum laude</em>
, Order of the Coif, Symposium Editor, Florida Law Review, Awards for highest
grades in Comparative Constitutional History, Legal Drafting, Real Property and
Sales, ', u'2007']
4)将抓取的学校信息写入schools.csv文件
你能帮我用 Python 写这个蜘蛛吗?我一直在尝试用 Scrapy 编写它,但没有成功。请参阅我之前的问题。
谢谢你。