aboutsummaryrefslogtreecommitdiffstats
path: root/scraper/brave.php
diff options
context:
space:
mode:
authorlolcat <will@lolcat.ca>2025-02-01 22:51:44 -0500
committerlolcat <will@lolcat.ca>2025-02-01 22:51:44 -0500
commit47a7a2a224620bcbeea822c9201bc76c94f191fe (patch)
treef16a9a499c1c39fa9a5230eb53d611cb9a627d83 /scraper/brave.php
parentf9f3c919d6df45da859ba46d3ba823e543ca636e (diff)
brave pagination fix
Diffstat (limited to 'scraper/brave.php')
-rw-r--r--scraper/brave.php75
1 files changed, 45 insertions, 30 deletions
diff --git a/scraper/brave.php b/scraper/brave.php
index eb5b3b0..e6f5908 100644
--- a/scraper/brave.php
+++ b/scraper/brave.php
@@ -403,7 +403,7 @@ class brave{
$nextpage =
$this->fuckhtml
- ->getElementsByClassName("btn", "a");
+ ->getElementsByClassName("button", "a");
if(count($nextpage) !== 0){
@@ -1777,42 +1777,57 @@ class brave{
$nextpage =
$this->fuckhtml
- ->getElementsByClassName("btn", "a");
+ ->getElementById(
+ "pagination",
+ "div"
+ );
- if(count($nextpage) !== 0){
+ if($nextpage){
+
+ $this->fuckhtml->load($nextpage);
$nextpage =
- $nextpage[count($nextpage) - 1];
+ $this->fuckhtml
+ ->getElementsByClassName(
+ "button",
+ "a"
+ );
- if(
- strtolower(
- $this->fuckhtml
- ->getTextContent(
- $nextpage
- )
- ) == "next"
- ){
+ if(count($nextpage) !== 0){
- preg_match(
- '/offset=([0-9]+)/',
- $this->fuckhtml->getTextContent($nextpage["attributes"]["href"]),
- $nextpage
- );
+ $nextpage =
+ $nextpage[count($nextpage) - 1];
- return
- $this->backend->store(
- json_encode(
- [
- "q" => $q,
- "offset" => (int)$nextpage[1],
- "nsfw" => $nsfw,
- "country" => $country,
- "spellcheck" => $spellcheck
- ]
- ),
- $page,
- $proxy
+ if(
+ strtolower(
+ $this->fuckhtml
+ ->getTextContent(
+ $nextpage
+ )
+ ) == "next"
+ ){
+
+ preg_match(
+ '/offset=([0-9]+)/',
+ $this->fuckhtml->getTextContent($nextpage["attributes"]["href"]),
+ $nextpage
);
+
+ return
+ $this->backend->store(
+ json_encode(
+ [
+ "q" => $q,
+ "offset" => (int)$nextpage[1],
+ "nsfw" => $nsfw,
+ "country" => $country,
+ "spellcheck" => $spellcheck
+ ]
+ ),
+ $page,
+ $proxy
+ );
+ }
}
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage