GithubHelp home page GithubHelp logo

Comments (5)

eliasdabbas avatar eliasdabbas commented on May 24, 2024 1

EDIT:

I just checked the sitemap of wrangler.com
https://www.wrangler.com/sitemap_index.xml

It seems they have a link to the sitemap index in the sitemap index. So they have a recursive reference. That's why it's doing it over and over. The best thing would be to extract the sitemaps individually and combine them into one DataFrame.

Screen Shot 2020-10-18 at 11 55 20 AM

from advertools.

eliasdabbas avatar eliasdabbas commented on May 24, 2024

Thanks.
The recursion is intentional, and it is doing what it is supposed to do. This happens on sitemap index files.
In the next version, there will be an option to retrieve just the sitemap requested in the function or do it recursively.
What exactly is your suggestion?

from advertools.

naidu-rohit avatar naidu-rohit commented on May 24, 2024

Yes, I was thinking we can first get a list of all unique sitemaps and then visit the urls. Or may be if we are doing depth first search, we can keep a 'visited sitemaps' list so that we don't visit them again. What do you think?

from advertools.

eliasdabbas avatar eliasdabbas commented on May 24, 2024

Thanks again.

I tested an approach that handles the case of recursive links without interruption. It worked, but I need to test more, and please let me know what you think:

  • If sitemap_url is a sitemap index
  • While iterating through the URLs
  • Check if current URL == sitemap_url
  • If so, append a new row to sitemap_df with:
    • sitemap: sitemap_url
    • errors: 'WARNING: Sitemap contains a link to itself'
  • Continue working as usual

This way, the user will not have to wait for an infinite loop (it won't happen), and they will also get the warning in the final sitemap_df, and it would be an easy fix.

Does that make sense?
Good catch by the way!

from advertools.

eliasdabbas avatar eliasdabbas commented on May 24, 2024

Fixed, and will be added to the next release.

from advertools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.