there is such a piece of script that gets h3 with the class "r" and displays true / false, but now r is always there and I want to do so - if one r is false, if two r is true. Tell me how to add a check for the presence of two classes "r" at the same time. I would be very grateful, good code to everyone.
function isIndexed(page,ignoreCase) { var urls=[],RETRIES=5; if(!page)return; if(page.indexOf("://")!==-1)page=page.split("://")[1].trim(); var url='https://www.google.com/search?q='+encodeURIComponent(page)+'&fp=1&dpr=2&sns=1&pf=p&tch=1&filter=0'; if(page.slice(-1)=="/")page=page.slice(0,-1); try { var serp=UrlFetchApp.fetch(url,{muteHttpExceptions:true,method:"GET",followRedirects:true}); var result=serp.getContentText().split('/*""*/'); var searchResults,serpResults,isIndexed=false; for(var i=2;i<result.length-1;i++) { searchResults=JSON.parse(result[i]); serpResults=searchResults.d.split('<h3 class="r"><a href="/url?q='); isIndexed=findIndexedURL(serpResults, page, ignoreCase); if(isIndexed) return "Yes"; } return "No"; } catch(e) { return "No"; } }