mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-30 23:55:24 +02:00
[SubstackBridge] Add Substack bridge (#4174)
* [SubstackBridge] Add Substack * [SubstackBridge] Add docs * [SubstackBridge] Fix lint * [SubstackBridge] Update description * [SubstackBridge] Update description (x2)
This commit is contained in:
parent
615c533587
commit
b505667168
3 changed files with 70 additions and 2 deletions
|
@ -7,7 +7,7 @@ abstract class FeedExpander extends BridgeAbstract
|
|||
{
|
||||
private array $feed;
|
||||
|
||||
public function collectExpandableDatas(string $url, $maxItems = -1)
|
||||
public function collectExpandableDatas(string $url, $maxItems = -1, $headers = [])
|
||||
{
|
||||
if (!$url) {
|
||||
throw new \Exception('There is no $url for this RSS expander');
|
||||
|
@ -17,7 +17,7 @@ abstract class FeedExpander extends BridgeAbstract
|
|||
$maxItems = 999;
|
||||
}
|
||||
$accept = [MrssFormat::MIME_TYPE, AtomFormat::MIME_TYPE, '*/*'];
|
||||
$httpHeaders = ['Accept: ' . implode(', ', $accept)];
|
||||
$httpHeaders = array_merge(['Accept: ' . implode(', ', $accept)], $headers);
|
||||
$xmlString = getContents($url, $httpHeaders);
|
||||
if ($xmlString === '') {
|
||||
throw new \Exception(sprintf('Unable to parse xml from `%s` because we got the empty string', $url), 10);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue