Created
June 2, 2021 16:03
-
-
Save VerifiedJoseph/ad058a22c23fc4c44dfbebc6bd735976 to your computer and use it in GitHub Desktop.
Simple script for testing rss-bridge website URIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// uses https://github.com/php-curl-class/php-curl-class | |
// Install: composer require php-curl-class/php-curl-class | |
// Composer Auto loader | |
require __DIR__ . '/vendor/autoload.php'; | |
$folder = ''; // rss-bridge path | |
require_once $folder . 'lib/BridgeInterface.php'; | |
require_once $folder . 'lib/BridgeAbstract.php'; | |
require_once $folder . 'lib/FeedExpander.php'; | |
require_once $folder . 'lib/XPathAbstract.php'; | |
require_once $folder . 'vendor/simplehtmldom/simple_html_dom.php'; | |
$files = scandir($folder . '\bridges'); | |
if($files !== false) { | |
foreach($files as $file) { | |
$failed = false; | |
if(preg_match('/^([^.]+)Bridge\.php$/U', $file, $out)) { | |
require_once $folder . 'bridges\\' . $file; | |
$name = $out[1] . 'Bridge'; | |
$class = new $name(); | |
$curl = new Curl\Curl(); | |
$curl->setUserAgent('Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0'); | |
$curl->setRetry(function ($instance) { | |
if ($instance->retries < 4) { | |
sleep(5); | |
return true; | |
} | |
return false; | |
}); | |
$curl->get($class::URI); | |
if ($curl->getCurlErrorCode() !== 0) { | |
echo $name . " \n"; | |
echo 'Error: ' . $curl->getCurlErrorCode() . ': ' . $curl->errorMessage . " \n"; | |
} | |
if ($curl->getHttpStatusCode() !== 200) { | |
echo $name . " \n"; | |
echo 'Failed: ' . $class::URI . ' (' . $curl->getHttpStatusCode() . ") \n"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment