Improve type-safety of wikidata fetcher
This commit is contained in:
parent
e91dfbf3ef
commit
7dde870afb
@ -343,30 +343,34 @@ final class NodaWikidataFetcher {
|
||||
$list = $doc->getElementsByTagName("style");
|
||||
while ($list->length > 0) {
|
||||
$p = $list->item(0);
|
||||
if ($p === null || $p->parentNode === null) break;
|
||||
$p->parentNode->removeChild($p);
|
||||
}
|
||||
|
||||
$list = $doc->getElementsByTagName("table");
|
||||
while ($list->length > 0) {
|
||||
$p = $list->item(0);
|
||||
if ($p === null || $p->parentNode === null) break;
|
||||
$p->parentNode->removeChild($p);
|
||||
}
|
||||
|
||||
$list = $doc->getElementsByTagName("div");
|
||||
while ($list->length > 1) {
|
||||
$p = $list->item(1);
|
||||
if ($p === null || $p->parentNode === null) break;
|
||||
$p->parentNode->removeChild($p);
|
||||
}
|
||||
|
||||
$list = $doc->getElementsByTagName("ol");
|
||||
while ($list->length > 0) {
|
||||
$p = $list->item(0);
|
||||
if ($p === null || $p->parentNode === null) break;
|
||||
$p->parentNode->removeChild($p);
|
||||
}
|
||||
|
||||
$firstP = $doc->getElementsByTagName("p")->item(0);
|
||||
if (strpos($doc->saveHTML($firstP), 'geohack') !== false) {
|
||||
$firstP->parentNode->removeChild($firstP);
|
||||
if ($firstP !== null && $firstP->parentNode !== null) $firstP->parentNode->removeChild($firstP);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user