1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-01-17 14:18:35 +01:00

[FirefoxAddonsBridge] Add detectParameters() (#1997)

This commit is contained in:
Joseph 2021-03-15 16:27:53 +00:00 committed by GitHub
parent 5c011c8d90
commit 700813e924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,19 @@ class FirefoxAddonsBridge extends BridgeAbstract {
private $xpiFileRegex = '/([A-Za-z0-9_.-]+)\.xpi$/';
private $outgoingRegex = '/https:\/\/outgoing.prod.mozaws.net\/v1\/(?:[A-z0-9]+)\//';
private $urlRegex = '/addons\.mozilla\.org\/(?:[\w-]+\/)?firefox\/addon\/([\w-]+)/';
public function detectParameters($url) {
$params = array();
if(preg_match($this->urlRegex, $url, $matches)) {
$params['id'] = $matches[1];
return $params;
}
return null;
}
public function collectData() {
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('Could not request: ' . $this->getURI());