导出指定域名的sitemap的URL地址,在seo方面的应用应该就是如果你想采集竞争对手网站的很多页面的时候就用得上,属于数据采集这一方面的;至于获取sitemap入口可以查看根目录下的robots.txt或sitemap.xml,再或者就在谷歌搜索框中搜索site:xxxxx.com filetype:xml或者site:xxxxx.com inurl:xml。下面是获取对手url的python代码:
#encoding=utf-8 import urllib import re url='https://bigwayseo.com/sitemap_baidu.xml' #改成自己想要获取的域名即可 html=urllib.urlopen(url).read() r=re.compile(r'(https://bigwayseo.com.*?)') #改成自己想要获取的域名即可 big=re.findall(r,html) for i in big: print i op_xml_txt=open('xml.txt','a') #sitemap的url地址都会导出到xml.txt op_xml_txt.write('%s\n'%i)
持续更新,持续来访。
收藏。