生成sitemap.xml
This commit is contained in:
parent
cd07ca54a0
commit
71186f3bec
@ -7,7 +7,7 @@ from bs4 import BeautifulSoup
|
||||
|
||||
url_root = 'https://git.zeekling.cn'
|
||||
url_mine_list = [
|
||||
'https://git.zeekling.cn',
|
||||
'https://git.zeekling.cn/',
|
||||
'https://git.zeekling.cn/zeekling'
|
||||
]
|
||||
|
||||
@ -27,7 +27,8 @@ url_robot_arr = [
|
||||
url_static_arr = [
|
||||
'.js',
|
||||
'.css',
|
||||
'.cscc'
|
||||
'.cscc',
|
||||
'None'
|
||||
]
|
||||
|
||||
|
||||
|
@ -9,11 +9,11 @@ import get_url
|
||||
|
||||
def create_xml(filename, url_list):
|
||||
header = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'
|
||||
file = open(filename, 'a', encoding='utf-8')
|
||||
file = open(filename, 'w', encoding='utf-8')
|
||||
file.writelines(header)
|
||||
file.close()
|
||||
times = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S+00:00")
|
||||
for url in url_list:
|
||||
times = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S+00:00")
|
||||
urls = re.sub(r"&", "&", url)
|
||||
ment = " <url>\n <loc>%s</loc>\n <lastmod>%s</lastmod>\n <changefreq>weekly</changefreq>\n <priority>0.8</priority>\n </url>\n" % (urls, times)
|
||||
file = open(filename, 'a', encoding='utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user