Write a browser bookmarklet in order to extract nested xml sitemaps links
- User
Write a browser bookmarklet in order to extract nested xml sitemaps links
Assistant
Here is a browser bookmarklet to extract nested xml sitemap links from a page:
javascript:(function(){ var sitemapLinks = []; var sitemaps = document.querySelectorAll('sitemapindex loc'); for(var i=0; i<sitemaps.length; i++){ var sitemapUrl = sitemaps[i].textContent; sitemapLinks.push(sitemapUrl); } var xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", sitemapLinks.join(',')); xmlHttp.send(); xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState == 4 && xmlHttp.status == 200) { var parser = new DOMParser(); var xmlDoc = parser.parseFromString(xmlHttp.responseText,"text/xml"); var nestedSitemaps = xmlDoc.querySelectorAll('sitemap loc'); for(var i=0; i<nestedSitemaps.length; i++){ sitemapLinks.push(nestedSitemaps[i].textContent); } console.log(sitemapLinks); } } })();
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.