Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from RSS-Bridge:master #133

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions bridges/ARDAudiothekBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ class ARDAudiothekBridge extends BridgeAbstract

public function collectData()
{
$oldTz = date_default_timezone_get();
$path = $this->getInput('path');
$limit = $this->getInput('limit');

$oldTz = date_default_timezone_get();
date_default_timezone_set('Europe/Berlin');

$pathComponents = explode('/', $this->getInput('path'));
$pathComponents = explode('/', $path);
if (empty($pathComponents)) {
returnClientError('Path may not be empty');
}
Expand All @@ -82,17 +84,21 @@ public function collectData()
}

$url = self::APIENDPOINT . 'programsets/' . $showID . '/';
$rawJSON = getContents($url);
$processedJSON = json_decode($rawJSON)->data->programSet;
$json1 = getContents($url);
$data1 = Json::decode($json1, false);
$processedJSON = $data1->data->programSet;
if (!$processedJSON) {
throw new \Exception('Unable to find show id: ' . $showID);
}

$limit = $this->getInput('limit');
$answerLength = 1;
$offset = 0;
$numberOfElements = 1;

while ($answerLength != 0 && $offset < $numberOfElements && (is_null($limit) || $offset < $limit)) {
$rawJSON = getContents($url . '?offset=' . $offset);
$processedJSON = json_decode($rawJSON)->data->programSet;
$json2 = getContents($url . '?offset=' . $offset);
$data2 = Json::decode($json2, false);
$processedJSON = $data2->data->programSet;

$answerLength = count($processedJSON->items->nodes);
$offset = $offset + $answerLength;
Expand Down
6 changes: 2 additions & 4 deletions bridges/CarThrottleBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class CarThrottleBridge extends BridgeAbstract

public function collectData()
{
$news = getSimpleHTMLDOMCached(self::URI . 'news')
or returnServerError('could not retrieve page');
$news = getSimpleHTMLDOMCached(self::URI . 'news');

$this->items[] = [];

Expand All @@ -22,8 +21,7 @@ public function collectData()
$item['uri'] = self::URI . $titleElement->getAttribute('href');
$item['title'] = $titleElement->innertext;

$articlePage = getSimpleHTMLDOMCached($item['uri'])
or returnServerError('could not retrieve page');
$articlePage = getSimpleHTMLDOMCached($item['uri']);

$authorDiv = $articlePage->find('div.author div');
if ($authorDiv) {
Expand Down
2 changes: 1 addition & 1 deletion bridges/EZTVBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function getEztvUri()
protected function getItemFromTorrent($torrent)
{
$item = [];
$item['uri'] = $torrent->episode_url;
$item['uri'] = $torrent->episode_url ?? $torrent->torrent_url;
$item['author'] = $torrent->imdb_id;
$item['timestamp'] = $torrent->date_released_unix;
$item['title'] = $torrent->title;
Expand Down
11 changes: 7 additions & 4 deletions bridges/RumbleBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ public function collectData()

$dom = getSimpleHTMLDOM($url);
foreach ($dom->find('ol.thumbnail__grid div.thumbnail__grid--item') as $video) {
$datetime = $video->find('time', 0)->getAttribute('datetime');

$this->items[] = [
$item = [
'title' => $video->find('h3', 0)->plaintext,
'uri' => self::URI . $video->find('a', 0)->href,
'timestamp' => (new \DateTimeImmutable($datetime))->getTimestamp(),
'author' => $account . '@rumble.com',
'content' => defaultLinkTo($video, self::URI)->innertext,
];
$time = $video->find('time', 0);
if ($time) {
$publishedAt = new \DateTimeImmutable($time->getAttribute('datetime'));
$item['timestamp'] = $publishedAt->getTimestamp();
}
$this->items[] = $item;
}
}

Expand Down
2 changes: 1 addition & 1 deletion bridges/TrelloBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public function collectData()
$action->type
];
if (isset($action->data->card)) {
$item['categories'][] = $action->data->card->name;
$item['categories'][] = $action->data->card->name ?? $action->data->card->id;
$item['uri'] = 'https://trello.com/c/'
. $action->data->card->shortLink
. '#action-'
Expand Down
6 changes: 5 additions & 1 deletion bridges/YoutubeBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ private function collectDataInternal()
$jsonData = $this->extractJsonFromHtml($html);
// TODO: this method returns only first 100 video items
// if it has more videos, playlistVideoListRenderer will have continuationItemRenderer as last element
$jsonData = $jsonData->contents->twoColumnBrowseResultsRenderer->tabs[0];
$jsonData = $jsonData->contents->twoColumnBrowseResultsRenderer->tabs[0] ?? null;
if (!$jsonData) {
// playlist probably doesnt exists
throw new \Exception('Unable to find playlist: ' . $url_listing);
}
$jsonData = $jsonData->tabRenderer->content->sectionListRenderer->contents[0]->itemSectionRenderer;
$jsonData = $jsonData->contents[0]->playlistVideoListRenderer->contents;
$item_count = count($jsonData);
Expand Down
Loading