i overengineered the fuck out of that baidu scraper jesus
This commit is contained in:
@@ -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
|
||||||
|
->getElementsByAttributeValue(
|
||||||
|
"tpl",
|
||||||
|
"www_index",
|
||||||
|
[$datafield]
|
||||||
|
);
|
||||||
|
|
||||||
|
if(
|
||||||
|
count($tpl_probe) === 0 &&
|
||||||
|
count(
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByClassName(
|
->getElementsByClassName(
|
||||||
"cosc-card",
|
"cosc-card",
|
||||||
$div
|
$div
|
||||||
);
|
)
|
||||||
|
) !== 0
|
||||||
if(count($card) !== 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 =
|
||||||
|
array_merge(
|
||||||
|
$tpl_probe,
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByClassName(
|
->getElementsByClassName(
|
||||||
"result",
|
"result",
|
||||||
[$datafield]
|
[$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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user