Archive for the '技术-python' Category


几个Python下用于screen scraping的工具集

几个在python下用于处理模板文件或解析html页面的工具集合,也即所谓的“Screen Scraping”。比用python 基础包的robotparser及htmlparser方便多了,也比直接用正则表达式效率高多了。一般而言,对于html页面的解析(搜索引擎的spider必须要做的事情)应该有如下几种方式处理:

1、正则表达式。

2、如果文件为xhtml的话(如果为普通html,可以借助诸如tidy转化为xhtml),对xhtml直接用xpath解析。

3、借助xml解析器对xhtml页面按照dom树或sax方式进行解析

  • BeautifulSoup

http://www.crummy.com/software/BeautifulSoup/

  • templatemaker

http://www.holovaty.com/blog/archive/2007/07/06/0128

  • webstemmer

http://www.unixuser.org/~euske/python/webstemmer/

  • twill(基于BeautifulSoup)

http://twill.idyll.org/

  • Perl版本的工具

http://www.perl.com/lpt/a/980

http://search.cpan.org/dist/Template-Extract/

http://search.cpan.org/~petdance/WWW-Mechanize/

http://search.cpan.org/dist/FEAR-API/

  • Ruby版本的工具

http://code.whytheluckystiff.net/hpricot/  基于HTreeJQuery

http://scrubyt.org/

http://ariel.rubyforge.org/

  • Java版本的工具

HTML Screen Scraping Tools Written in Java

好像没有提到http://htmlparser.sourceforge.net/,挺方便的。

 

PS .发现两个不错的服务,有空研究一下:

  • 自定义API的工具dapper:

 http://www.dapper.net/,有空研究一下怎样利用以上工具实现

  • MIT的个人信息门户piggy-bank及Solvent

以前看过,基于firefox插件的,piggy-bank的思路很值得借鉴,尤其是做个人门户。

http://simile.mit.edu/wiki/Solvent

http://simile.mit.edu/piggy-bank/

 

twisted相关的学习资料

Twisted是一个专门用于python的网络开发的框架。可以说是现在python中新的一支至力于发展高性能网络开发的框架,发展很稳定。

此处用于收集记录twisted一些相关的学习资料和文档。

Twisted的官方文档

http://twistedmatrix.com/trac/wiki/Documentation

OReilly.Twisted.Network.Programming.Essentials.

Untwisting Python Network Programming

Twisted Network Programming Essentials在amazhon的口碑并不好,看了一下前几章,发觉还不如看文档。

slideshare上关于asynchronous io编程的ppt

http://www.slideshare.net

有一篇http://www.slideshare.net/Arbow/asynchronous-io-programming讲得很不错。

啄木鸟社区

http://wiki.woodpecker.org.cn/moin/PyTwisted

ActiveState ASPN上twisted例子

http://aspn.activestate.com/ASPN/search?query=twisted&x=0&y=0&section=PYTHONCKBK&type=Subsection

wiki.python.org上twisted例子

http://wiki.python.org/moin/Twisted-Examples?action=fullsearch&context=180&value=twisted&fullsearch=%E6%AD%A3%E6%96%87

Event-Driven Programming with Twisted and Python

http://www.linuxjournal.com/node/7871/print

使用 Twisted 框架进行网络编程

http://www.ibm.com/developerworks/cn/linux/network/l-twist/part1/

http://www.ibm.com/developerworks/cn/linux/network/l-twist/part2/

http://www.ibm.com/developerworks/cn/linux/network/l-twist/part3/

http://www.ibm.com/developerworks/cn/linux/network/l-twist/part4/

An Introduction to the Twisted Networking Framework

http://www.onlamp.com/pub/a/python/2004/01/15/twisted_intro.html

The Twisted Network Framework

http://www.python10.org/p10-papers/09/index.htm

使用Twisted框架进行MMP服务整合

http://book.csdn.net/bookfiles/329/10032913215.shtml

Twisted vs Threads Benchmark

http://kaishaku.org/twisted-vs-threads/

Twisted defer

http://python.fyxm.net/pycon/papers/deferex/

Twisted Patterns

http://www.rexx.com/~dkuhlman/twisted_patterns.html

Making and deploying a Twisted project as a service under Windows

http://www.adelux.fr/libre/howto/en/twisted_windows

Network Programming for the Rest of Us

http://www.usenix.org/events/usenix03/tech/freenix03/full_papers/lefkowitz/lefkowitz_html/index.html

Using Python and Twisted to Write Reliable Peer-to_peer Programs

http://www.python.org/pycon/2005/papers/73/

http://twistedmatrix.com/users/warner/doc-latest/mail/tutorial/smtpclient/smtpclient.html

Technorati 标签: , , ,