其他Python工具
avoin的Python项目详细描述
#雅芳 数据抓取的python代码 (c)2012年Ville Korhonen(ville@xd.fi),GPLv3
##安装 您可以使用以下命令直接从pypi安装:
pip install avoin
或者通过git获得最新的头部:
pip install git+https://github.com/ypcs/avoin.git#egg=avoin
- 使用(通过python shell)
>>> from avoin.scraper.scraper import DefaultScraper, html_title_parser >>> scraper = DefaultScraper() >>> url = 'http://www.google.com/'
>>> result = scraper.parse(url, parser=html_title_parser) >>> print result Google
>>> result = scraper.parse(url, parser=html_title_parser, format='json') >>> print result "Google"
##使用(通过命令行) 以明文形式从网页获取所有URL
avoin xpath –url ‘http://ypcs.fi/’ –xpath ‘//a/@href’ –format text