我怎么能只得到site.com网站使用python从搜索结果中获得关于googleseach中单词的见解?在
from xgoogle.search import GoogleSearch, SearchError
try:
page = 1
gs = GoogleSearch("#hashtag insights")
gs.results_per_page = 100
results = []
while True:
tmp = gs.get_results()
if not tmp: # no more results were found
break
results.extend(tmp)
# ... do something with all the results ...
except SearchError, e:
print "Search failed: %s" % e
for res in results:
print res.url
使用regex尝试如下:
如果您有一个更一般的网站,您可以:
^{pr2}$不需要正则表达式,请使用
urlparse
http://docs.python.org/library/urlparse.html
相关问题 更多 >
编程相关推荐