Преглед на файлове

filter ads from the html endpoint

lolcat преди 1 година
родител
ревизия
4b16fd5897
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  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(