驯服猞猁的工具。
siegfried的Python项目详细描述
siegfried==
安装
pip install siegfried
测试
需要nose
nosetests
用法
本模块包含各种方法,这些方法贯穿始终 newslnyx。但主要功能是unshorten_url, is_article_url,和prepare_url:
fromsiegfriedimport(unshorten_url,is_article_url,prepare_url)printunshorten_url('bit.ly/1j3SrUC')# http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism/printis_article_url('http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism')# Trueprintis_article_url('http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism',pattern=r'.*towcenter\.org/blog/.*')# Trueimportrepattern=re.compile(r'.*towcenter\.org/blog/.*')printis_article_url('http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism',pattern=pattern)# Trueprintprepare_url('http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism/?q=lfjad&f=lkfdjsal')# http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism