mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-14 20:21:14 +03:00
added the option for a sessioncookie in heiseBridge (#3596)
* added the option for a sessioncookie with a valid cookie you can get full heise+ (paywall) articles * formating * lint --------- Co-authored-by: Dag <me@dvikan.no>
This commit is contained in:
parent
7661a78a43
commit
d32419ffcf
1 changed files with 15 additions and 2 deletions
|
@ -103,6 +103,16 @@ class HeiseBridge extends FeedExpander
|
|||
'required' => false,
|
||||
'title' => 'Specify number of full articles to return',
|
||||
'defaultValue' => 5
|
||||
],
|
||||
'sessioncookie' => [
|
||||
'name' => 'Session Cookie',
|
||||
'required' => false,
|
||||
'title' => <<<'TITLE'
|
||||
If you have a heise+ subscription,
|
||||
you can enter your cookie (ssohls) here to
|
||||
have heise+ articles displayed in full.
|
||||
By default the cookie is 1 year valid.
|
||||
TITLE,
|
||||
]
|
||||
]];
|
||||
const LIMIT = 5;
|
||||
|
@ -118,6 +128,7 @@ class HeiseBridge extends FeedExpander
|
|||
protected function parseItem($feedItem)
|
||||
{
|
||||
$item = parent::parseItem($feedItem);
|
||||
$sessioncookie = $this->getInput('sessioncookie');
|
||||
|
||||
// strip rss parameter
|
||||
$item['uri'] = explode('?', $item['uri'])[0];
|
||||
|
@ -128,13 +139,15 @@ class HeiseBridge extends FeedExpander
|
|||
}
|
||||
|
||||
// abort on heise+ articles and link to archive.ph for full-text content
|
||||
if (str_starts_with($item['title'], 'heise+ |')) {
|
||||
if ($sessioncookie == '' && str_starts_with($item['title'], 'heise+ |')) {
|
||||
$item['uri'] = 'https://archive.ph/?run=1&url=' . urlencode($item['uri']);
|
||||
return $item;
|
||||
}
|
||||
|
||||
$item['uri'] .= '?seite=all';
|
||||
$article = getSimpleHTMLDOMCached($item['uri']);
|
||||
$article = getSimpleHTMLDOM($item['uri'], [
|
||||
'cookie: ssohls=' . $sessioncookie
|
||||
]);
|
||||
|
||||
if ($article) {
|
||||
$article = defaultLinkTo($article, $item['uri']);
|
||||
|
|
Loading…
Add table
Reference in a new issue