In this tutorial i’m going to learn how to generate sitematap using python. I have described in very easy and generate the sitemap where user put url then crawl all website url.
Read this -> Python Installation
Run below package for generate the sitemap
pip install sitemap-generator
Next to create app.py file and put below code
import sys
import logging
from pysitemap import crawler
if __name__ == "__main__":
if "--iocp" in sys.argv:
from asyncio import events, windows_events
sys.argv.remove('--iocp')
logging.info('using iocp')
el = windows_events.ProactorEventLoop()
events.set_event_loop(el)
# root_url = sys.argv[1]
root_url = 'https://www.edureka.co'
crawler(root_url, out_file='sitemap.xml')
Next to create this file name
sitemap.xml
Next to run below command in cmd
python app.py
Now its crawling succesfully.