Pārlūkot izejas kodu

filter ads from the html endpoint

lolcat 10 mēneši atpakaļ
vecāks
revīzija
4b16fd5897
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      scraper/ddg.php

+ 6 - 0
scraper/ddg.php

@@ -679,6 +679,12 @@ class ddg{
 			
 			$this->fuckhtml->load($result);
 			
+			if(stripos($result["attributes"]["class"], "result--ad") !== false){
+				
+				// found an ad
+				continue;
+			}
+			
 			$title =
 				$this->fuckhtml
 				->getElementsByTagName(