forked from RSS-Bridge/rss-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
40 changed files
with
785 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
class AllSidesBridge extends BridgeAbstract | ||
{ | ||
const NAME = 'AllSides'; | ||
const URI = 'https://www.allsides.com'; | ||
const DESCRIPTION = 'Balanced news and media bias ratings.'; | ||
const MAINTAINER = 'Oliver Nutter'; | ||
const PARAMETERS = [ | ||
'global' => [ | ||
'limit' => [ | ||
'name' => 'Number of posts to return', | ||
'type' => 'number', | ||
'defaultValue' => 10, | ||
'required' => false, | ||
'title' => 'Zero or negative values return all posts (ignored if not fetching full article)', | ||
], | ||
'fetch' => [ | ||
'name' => 'Fetch full article content', | ||
'type' => 'checkbox', | ||
'defaultValue' => 'checked', | ||
], | ||
], | ||
'Headline Roundups' => [], | ||
]; | ||
|
||
private const ROUNDUPS_URI = self::URI . '/headline-roundups'; | ||
|
||
public function collectData() | ||
{ | ||
switch ($this->queriedContext) { | ||
case 'Headline Roundups': | ||
$index = getSimpleHTMLDOM(self::ROUNDUPS_URI); | ||
defaultLinkTo($index, self::ROUNDUPS_URI); | ||
$entries = $index->find('table.views-table > tbody > tr'); | ||
|
||
$limit = (int) $this->getInput('limit'); | ||
$fetch = (bool) $this->getInput('fetch'); | ||
|
||
if ($limit > 0 && $fetch) { | ||
$entries = array_slice($entries, 0, $limit); | ||
} | ||
|
||
foreach ($entries as $entry) { | ||
$item = [ | ||
'title' => $entry->find('.views-field-name', 0)->text(), | ||
'uri' => $entry->find('a', 0)->href, | ||
'timestamp' => $entry->find('.date-display-single', 0)->content, | ||
'author' => 'AllSides Staff', | ||
]; | ||
|
||
if ($fetch) { | ||
$article = getSimpleHTMLDOMCached($item['uri']); | ||
defaultLinkTo($article, $item['uri']); | ||
|
||
$item['content'] = $article->find('.story-id-page-description', 0); | ||
|
||
foreach ($article->find('.page-tags a') as $tag) { | ||
$item['categories'][] = $tag->text(); | ||
} | ||
} | ||
|
||
$this->items[] = $item; | ||
} | ||
break; | ||
} | ||
} | ||
|
||
public function getName() | ||
{ | ||
if ($this->queriedContext) { | ||
return self::NAME . " - {$this->queriedContext}"; | ||
} | ||
return self::NAME; | ||
} | ||
|
||
public function getURI() | ||
{ | ||
switch ($this->queriedContext) { | ||
case 'Headline Roundups': | ||
return self::ROUNDUPS_URI; | ||
} | ||
return self::URI; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
class AllocineFRSortiesBridge extends BridgeAbstract | ||
{ | ||
const MAINTAINER = 'Simounet'; | ||
const NAME = 'AlloCiné Sorties Bridge'; | ||
const CACHE_TIMEOUT = 25200; // 7h | ||
const BASE_URI = 'https://www.allocine.fr'; | ||
const URI = self::BASE_URI . '/film/sorties-semaine/'; | ||
const DESCRIPTION = 'Bridge for AlloCiné - Sorties cinéma cette semaine'; | ||
|
||
public function getName() | ||
{ | ||
return self::NAME; | ||
} | ||
|
||
public function collectData() | ||
{ | ||
$html = getSimpleHTMLDOM($this->getURI()); | ||
|
||
foreach ($html->find('section.section.section-wrap', 0)->find('li.mdl') as $element) { | ||
$item = []; | ||
|
||
$thumb = $element->find('figure.thumbnail', 0); | ||
$meta = $element->find('div.meta-body', 0); | ||
$synopsis = $element->find('div.synopsis', 0); | ||
|
||
$title = $element->find('a[class*=meta-title-link]', 0); | ||
$content = trim(defaultLinkTo($thumb->outertext . $meta->outertext . $synopsis->outertext, static::URI)); | ||
|
||
// Replace image 'src' with the one in 'data-src' | ||
$content = preg_replace('@src="data:image/gif;base64,[A-Za-z0-9=+\/]*"@', '', $content); | ||
$content = preg_replace('@data-src=@', 'src=', $content); | ||
|
||
$item['content'] = $content; | ||
$item['title'] = trim($title->innertext); | ||
$item['uri'] = static::BASE_URI . '/' . substr($title->href, 1); | ||
$this->items[] = $item; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
class GameBananaBridge extends BridgeAbstract | ||
{ | ||
const NAME = 'GameBanana'; | ||
const MAINTAINER = 'phantop'; | ||
const URI = 'https://gamebanana.com/'; | ||
const DESCRIPTION = 'Returns mods from GameBanana.'; | ||
const PARAMETERS = [ | ||
'Game' => [ | ||
'gid' => [ | ||
'name' => 'Game ID', | ||
'required' => true, | ||
// Example: latest mods from Zelda: Tears of the Kingdom | ||
'exampleValue' => '7617', | ||
], | ||
'updates' => [ | ||
'name' => 'Get updates', | ||
'type' => 'checkbox', | ||
'required' => false, | ||
'title' => 'Enable game updates in feed' | ||
], | ||
] | ||
]; | ||
|
||
public function getIcon() | ||
{ | ||
return 'https://images.gamebanana.com/static/img/favicon/favicon.ico'; | ||
} | ||
|
||
public function collectData() | ||
{ | ||
$url = 'https://api.gamebanana.com/Core/List/New?itemtype=Mod&page=1&gameid=' . $this->getInput('gid'); | ||
if ($this->getInput('updates')) { | ||
$url .= '&include_updated=1'; | ||
} | ||
$api_response = getContents($url); | ||
$json_list = json_decode($api_response, true); // Get first page mod list | ||
|
||
$url = 'https://api.gamebanana.com/Core/Item/Data?itemtype[]=Game&fields[]=name&itemid[]=' . $this->getInput('gid'); | ||
$fields = 'name,Owner().name,text,screenshots,Files().aFiles(),date,Url().sProfileUrl(),udate'; | ||
foreach ($json_list as $element) { // Build api request to minimize API calls | ||
$mid = $element[1]; | ||
$url .= '&itemtype[]=Mod&fields[]=' . $fields . '&itemid[]=' . $mid; | ||
} | ||
$api_response = getContents($url); | ||
$json_list = json_decode($api_response, true); | ||
|
||
$this->title = $json_list[0][0]; | ||
array_shift($json_list); // Take title from API request and remove from json | ||
|
||
foreach ($json_list as $element) { | ||
$item = []; | ||
$item['uri'] = $element[6]; | ||
$item['comments'] = $item['uri'] . '#PostsListModule'; | ||
$item['title'] = $element[0]; | ||
$item['author'] = $element[1]; | ||
|
||
$item['timestamp'] = $element[5]; | ||
if ($this->getInput('updates')) { | ||
$item['timestamp'] = $element[7]; | ||
} | ||
|
||
$item['enclosures'] = []; | ||
foreach ($element[4] as $file) { // Place mod downloads in enclosures | ||
array_push($item['enclosures'], 'https://files.gamebanana.com/mods/' . $file['_sFile']); | ||
} | ||
|
||
// Get screenshots from element[3] | ||
$img_list = json_decode($element[3], true); | ||
$item['content'] = ''; | ||
foreach ($img_list as $img_element) { | ||
$item['content'] .= '<img src="https://images.gamebanana.com/img/ss/mods/' . $img_element['_sFile'] . '"/>'; | ||
} | ||
$item['content'] .= '<br>' . $element[2]; | ||
|
||
$item['uid'] = $item['uri'] . $item['title'] . $item['timestamp']; | ||
$this->items[] = $item; | ||
} | ||
} | ||
|
||
public function getName() | ||
{ | ||
$name = parent::getName(); | ||
if (isset($this->title)) { | ||
$name .= " - $this->title"; | ||
} | ||
return $name; | ||
} | ||
|
||
public function getURI() | ||
{ | ||
$uri = parent::getURI() . 'games/' . $this->getInput('gid'); | ||
return $uri; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
class GoAccessBridge extends BridgeAbstract | ||
{ | ||
const MAINTAINER = 'Simounet'; | ||
const NAME = 'GoAccess'; | ||
const URI_BASE = 'https://goaccess.io'; | ||
const URI = self::URI_BASE . '/release-notes'; | ||
const CACHE_TIMEOUT = 21600; //6h | ||
const DESCRIPTION = 'GoAccess releases.'; | ||
|
||
public function collectData() | ||
{ | ||
$html = getSimpleHTMLDOM(self::URI); | ||
|
||
$container = $html->find('.container.content', 0); | ||
foreach ($container->find('div') as $element) { | ||
$titleEl = $element->find('h2', 0); | ||
$dateEl = $titleEl->find('small', 0); | ||
$date = trim($dateEl->plaintext); | ||
$title = is_object($titleEl) ? str_replace($date, '', $titleEl->plaintext) : ''; | ||
$linkEl = $titleEl->find('a', 0); | ||
$link = is_object($linkEl) ? $linkEl->href : ''; | ||
$postUrl = self::URI . $link; | ||
|
||
$contentEl = $element->find('.dl-horizontal', 0); | ||
$content = '<dl>' . $contentEl->xmltext() . '</dl>'; | ||
|
||
$item = []; | ||
$item['uri'] = $postUrl; | ||
$item['timestamp'] = strtotime($date); | ||
$item['title'] = $title; | ||
$item['content'] = $content; | ||
|
||
$this->items[] = $item; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.