mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-03 09:35:57 +02:00
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
This commit is contained in:
parent
66568e3a39
commit
4f75591060
398 changed files with 58607 additions and 56442 deletions
|
@ -1,46 +1,48 @@
|
|||
<?php
|
||||
|
||||
class ItchioBridge extends BridgeAbstract {
|
||||
const NAME = 'itch.io';
|
||||
const URI = 'https://itch.io';
|
||||
const DESCRIPTION = 'Fetches the file uploads for a product';
|
||||
const MAINTAINER = 'jacquesh';
|
||||
const PARAMETERS = array(array(
|
||||
'url' => array(
|
||||
'name' => 'Product URL',
|
||||
'exampleValue' => 'https://remedybg.itch.io/remedybg',
|
||||
'required' => true,
|
||||
)
|
||||
));
|
||||
const CACHE_TIMEOUT = 21600; // 6 hours
|
||||
class ItchioBridge extends BridgeAbstract
|
||||
{
|
||||
const NAME = 'itch.io';
|
||||
const URI = 'https://itch.io';
|
||||
const DESCRIPTION = 'Fetches the file uploads for a product';
|
||||
const MAINTAINER = 'jacquesh';
|
||||
const PARAMETERS = [[
|
||||
'url' => [
|
||||
'name' => 'Product URL',
|
||||
'exampleValue' => 'https://remedybg.itch.io/remedybg',
|
||||
'required' => true,
|
||||
]
|
||||
]];
|
||||
const CACHE_TIMEOUT = 21600; // 6 hours
|
||||
|
||||
public function collectData() {
|
||||
$url = $this->getInput('url');
|
||||
$html = getSimpleHTMLDOM($url);
|
||||
public function collectData()
|
||||
{
|
||||
$url = $this->getInput('url');
|
||||
$html = getSimpleHTMLDOM($url);
|
||||
|
||||
$title = $html->find('.game_title', 0)->innertext;
|
||||
$title = $html->find('.game_title', 0)->innertext;
|
||||
|
||||
$content = 'The following files are available to download:<br/>';
|
||||
foreach ($html->find('div.upload') as $element) {
|
||||
$filename = $element->find('strong.name', 0)->innertext;
|
||||
$filesize = $element->find('span.file_size', 0)->first_child()->innertext;
|
||||
$content = $content . $filename . ' (' . $filesize . ')<br/>';
|
||||
}
|
||||
$content = 'The following files are available to download:<br/>';
|
||||
foreach ($html->find('div.upload') as $element) {
|
||||
$filename = $element->find('strong.name', 0)->innertext;
|
||||
$filesize = $element->find('span.file_size', 0)->first_child()->innertext;
|
||||
$content = $content . $filename . ' (' . $filesize . ')<br/>';
|
||||
}
|
||||
|
||||
// On 2021-04-28/29, itch.io changed their project page format so that the
|
||||
// 'last updated' timestamp is only shown to logged-in users.
|
||||
// Since we can't use the last-updated date to identify a post, we include
|
||||
// the description text in the input for the UID hash so that if the
|
||||
// project posts an update that changes the description but does not add
|
||||
// or rename any files, we'll still flag it as an update.
|
||||
$project_description = $html->find('div.formatted_description', 0)->plaintext;
|
||||
$uidContent = $project_description . $content;
|
||||
// On 2021-04-28/29, itch.io changed their project page format so that the
|
||||
// 'last updated' timestamp is only shown to logged-in users.
|
||||
// Since we can't use the last-updated date to identify a post, we include
|
||||
// the description text in the input for the UID hash so that if the
|
||||
// project posts an update that changes the description but does not add
|
||||
// or rename any files, we'll still flag it as an update.
|
||||
$project_description = $html->find('div.formatted_description', 0)->plaintext;
|
||||
$uidContent = $project_description . $content;
|
||||
|
||||
$item = array();
|
||||
$item['uri'] = $url;
|
||||
$item['uid'] = $uidContent;
|
||||
$item['title'] = 'Update for ' . $title;
|
||||
$item['content'] = $content;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
$item = [];
|
||||
$item['uri'] = $url;
|
||||
$item['uid'] = $uidContent;
|
||||
$item['title'] = 'Update for ' . $title;
|
||||
$item['content'] = $content;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue