i overengineered the fuck out of that baidu scraper jesus

This commit is contained in:
2026-07-05 01:57:56 -04:00
parent 8328d93b17
commit 46411a6c83

View File

@@ -666,14 +666,24 @@ class baidu{
// //
// Don't parse as a search result if it's a card // Don't parse as a search result if it's a card
// //
$card = $tpl_probe =
$this->fuckhtml $this->fuckhtml
->getElementsByClassName( ->getElementsByAttributeValue(
"cosc-card", "tpl",
$div "www_index",
[$datafield]
); );
if(count($card) !== 0){ if(
count($tpl_probe) === 0 &&
count(
$this->fuckhtml
->getElementsByClassName(
"cosc-card",
$div
)
) !== 0
){
// //
// Parse chinese youtube shorts // Parse chinese youtube shorts
@@ -870,10 +880,13 @@ class baidu{
// class:FYB_RD -> News garbage, IGNORE // class:FYB_RD -> News garbage, IGNORE
$result = $result =
$this->fuckhtml array_merge(
->getElementsByClassName( $tpl_probe,
"result", $this->fuckhtml
[$datafield] ->getElementsByClassName(
"result",
[$datafield]
)
); );
if(count($result) !== 0){ if(count($result) !== 0){
@@ -885,7 +898,7 @@ class baidu{
$title = $title =
$this->fuckhtml $this->fuckhtml
->getElementsByClassName( ->getElementsByClassName(
"sc-link", "cosc-title-a",
"a" "a"
); );
@@ -905,8 +918,9 @@ class baidu{
$description = $description =
$this->fuckhtml $this->fuckhtml
->getElementsByClassName( ->getElementsByAttributeValue(
"c-color", "data-sanssr-cmpt",
"card/www-summary-1",
$div $div
); );