1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-06-10 08:35:07 +02:00

[FabBridge] Pull 100% discounted items via Fab API (#4584)

* [FabBridge] Pull 100% discounted items via Fab API

* [FabBridge] Linter fixes
This commit is contained in:
Tobias Alexander Franke 2025-06-04 22:15:28 +02:00 committed by GitHub
parent 98e03011db
commit 7aa54602cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

43
bridges/FabBridge.php Normal file
View File

@ -0,0 +1,43 @@
<?php
class FabBridge extends BridgeAbstract
{
const NAME = 'Epic Games Fab.com';
const URI = 'https://www.fab.com';
const DESCRIPTION = 'Limited-Time Free Game Engine Assets';
const MAINTAINER = 'thefranke';
const CACHE_TIMEOUT = 86400;
public function collectData()
{
$url = static::URI . '/i/listings/search?is_discounted=1&is_free=1';
$header = [
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:139.0) Gecko/20100101 Firefox/139.0',
'Accept: application/json, text/plain, */*',
'Accept-Language: en',
'Accept-Encoding: gzip, deflate, br, zstd',
'Referer: ' . static::URI
];
$json = getContents($url, $header);
$json = json_decode($json);
foreach ($json->results as $item) {
$thumbnail = $item->thumbnails[0]->mediaUrl;
$itemurl = static::URI . '/listings/' . $item->uid;
$itemapiurl = static::URI . '/i/listings/' . $item->uid;
$itemjson = getContents($itemapiurl, $header);
$itemjson = json_decode($itemjson);
$this->items[] = [
'title' => $item->title,
'author' => $item->user->sellerName,
'uri' => $itemurl,
'timestamp' => strtotime($item->lastUpdatedAt),
'content' => '<a href="' . $itemurl . '"><img src="' . $thumbnail . '"></a>' . $itemjson->description,
];
}
}
}