mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-25 10:56:18 +03:00
[PatreonBridge] Resolve creator name in feed name (#3616)
* resolve creators without custom url * hint how to enter creator with non-custom url * applied phpcbf
This commit is contained in:
parent
7a1180c80f
commit
28077155ca
1 changed files with 10 additions and 4 deletions
|
@ -6,13 +6,13 @@ class PatreonBridge extends BridgeAbstract
|
|||
const URI = 'https://www.patreon.com/';
|
||||
const CACHE_TIMEOUT = 300; // 5min
|
||||
const DESCRIPTION = 'Returns posts by creators on Patreon';
|
||||
const MAINTAINER = 'Roliga';
|
||||
const PARAMETERS = [ [
|
||||
const MAINTAINER = 'Roliga, mruac';
|
||||
const PARAMETERS = [[
|
||||
'creator' => [
|
||||
'name' => 'Creator',
|
||||
'type' => 'text',
|
||||
'required' => true,
|
||||
'exampleValue' => 'sanityinc',
|
||||
'exampleValue' => 'user?u=13425451',
|
||||
'title' => 'Creator name as seen in their page URL'
|
||||
]
|
||||
]];
|
||||
|
@ -189,7 +189,13 @@ class PatreonBridge extends BridgeAbstract
|
|||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('creator'))) {
|
||||
return $this->getInput('creator') . ' posts';
|
||||
$html = getSimpleHTMLDOMCached($this->getURI());
|
||||
if ($html) {
|
||||
preg_match('#"name": "(.*)"#', $html->save(), $matches);
|
||||
return 'Patreon posts from ' . stripcslashes($matches[1]);
|
||||
} else {
|
||||
return $this->getInput('creator') . 'posts from Patreon';
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
|
|
Loading…
Reference in a new issue