Skip to content

Commit

Permalink
fix(pokemonnews): throw if antibot, RSS-Bridge#3327 (RSS-Bridge#3562)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvikan authored Jul 21, 2023
1 parent d08b261 commit 39a8346
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bridges/PokemonNewsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public function collectData()
// todo: parse json api instead: https://www.pokemon.com/api/1/us/news/get-news.json
$url = 'https://www.pokemon.com/us/pokemon-news';
$dom = getSimpleHTMLDOM($url);

$haystack = (string)$dom;
if (str_contains($haystack, 'Request unsuccessful. Incapsula incident')) {
throw new \Exception('Blocked by anti-bot');
}
foreach ($dom->find('.news-list ul li') as $item) {
$title = $item->find('h3', 0)->plaintext;
$description = $item->find('p.hidden-mobile', 0);
Expand Down

0 comments on commit 39a8346

Please sign in to comment.