mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[RedditBridge] Add detectParameters (#2070)
This commit is contained in:
parent
13e9a96cf3
commit
4f7ef212b7
@ -48,6 +48,26 @@ class RedditBridge extends BridgeAbstract {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public function detectParameters($url) {
|
||||||
|
$parsed_url = parse_url($url);
|
||||||
|
|
||||||
|
if ($parsed_url['host'] != 'www.reddit.com' && $parsed_url['host'] != 'old.reddit.com') return null;
|
||||||
|
|
||||||
|
$path = explode('/', $parsed_url['path']);
|
||||||
|
|
||||||
|
if ($path[1] == 'r') {
|
||||||
|
return array(
|
||||||
|
'r' => $path[2]
|
||||||
|
);
|
||||||
|
} elseif ($path[1] == 'user') {
|
||||||
|
return array(
|
||||||
|
'u' => $path[2]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getIcon() {
|
public function getIcon() {
|
||||||
return 'https://www.redditstatic.com/desktop2x/img/favicon/favicon-96x96.png';
|
return 'https://www.redditstatic.com/desktop2x/img/favicon/favicon-96x96.png';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user