Comments (5)
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.
from advertools.
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.
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.
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'
- sitemap:
- 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.
Fixed, and will be added to the next release.
from advertools.
Related Issues (20)
- Getting NaN values for serp_goog function HOT 3
- File not found on crawl method HOT 4
- opening .jl file command doesn't show 'my_output_file.jl' HOT 7
- crawl dataFrame - jsonld objects HOT 2
- Suggestion - don't treat jsonld items in distinct script tags as distinct. HOT 8
- How to get initial url in output.jl ? HOT 2
- Bypass protection HOT 3
- Need some way to rate limit requests for sitemap_to_df HOT 3
- Scraps forever HOT 3
- Feature Request - Alternative Crawl Output HOT 5
- Python 3.10/11 SSL: SSLV3_ALERT_HANDSHAKE_FAILURE HOT 5
- Advertools in Ubuntu in a Venv (Python 3.10.12 and Python 3.9.18) HOT 7
- browser can get https://zapier.com but when run scrape failed HOT 2
- logs_to_df() Limitation HOT 5
- Bypass a cookie wall HOT 4
- Pandas Futurewarning "fillna" in url_to_df() HOT 1
- request_url_df creates wide list? HOT 3
- How to get started with development? HOT 7
- Instagram Mentions Allows Periods HOT 1
- about this result in serp HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from advertools.