estrarre gli URL dalla sitemap

PHOTO EMBED

Tue Nov 14 2023 11:05:45 GMT+0000 (Coordinated Universal Time)

Saved by @dona__x

def get_urls_from_sitemap(sitemap_url=None):
    sitemap = get_sitemap_from_url(sitemap_url)
    if sitemap is None:
        return None
    document = parseString(sitemap)
    locations = document.getElementsByTagName('loc')
    urls = []
    for location in locations:
        urls.append(location.firstChild.nodeValue)
    return urls
content_copyCOPY

https://gabrieleromanato.com/2022/08/python-estrarre-gli-url-da-una-sitemap