From 154b9c616853516a02612737a37e0e4d6949b712 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Wed, 22 Oct 2025 16:41:14 +0200 Subject: [PATCH] Neue Bridge: Futurama: Hit & Run Mod Releases --- FuturamaHitAndRunBridge.php | 110 ++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 FuturamaHitAndRunBridge.php diff --git a/FuturamaHitAndRunBridge.php b/FuturamaHitAndRunBridge.php new file mode 100644 index 0000000..c224038 --- /dev/null +++ b/FuturamaHitAndRunBridge.php @@ -0,0 +1,110 @@ +find('div.component-block h3.component-header'); + + foreach ($versionBlocks as $versionHeader) { + // Get version number from header + $versionText = trim($versionHeader->find('div.text', 0)->plaintext ?? ''); + if (empty($versionText)) continue; + + // Skip branch names - only process actual version numbers (e.g., 0.1.0, 1.2.3) + // Version numbers typically contain dots or start with numbers + if (!preg_match('/^\d+\./', $versionText)) continue; + + // Get the parent block containing all version information + $versionBlock = $versionHeader->parent(); + if (!$versionBlock) continue; + + $item = []; + $item['title'] = 'Futurama: Hit & Run - Version ' . $versionText; + $item['uid'] = 'futurama-har-' . $versionText; + + // Find version ID from badges + $badges = $versionBlock->find('div.component-badge'); + foreach ($badges as $badge) { + $badgeText = $badge->plaintext; + if (strpos($badgeText, 'ID ') !== false) { + preg_match('/ID (\d+)/', $badgeText, $matches); + if (isset($matches[1])) { + $item['uid'] = 'futurama-har-id-' . $matches[1]; + } + } + + // Get published date + if (strpos($badgeText, 'Published') !== false) { + $timeElement = $badge->find('time.component-human-time', 0); + if ($timeElement && $timeElement->datetime) { + $item['timestamp'] = strtotime($timeElement->datetime); + } + } + } + + // Use the project downloads page as article link + $item['uri'] = self::URI; + + // Find download link for content + $downloadLink = null; + $downloadBtn = $versionBlock->find('a.component-button', 0); + if ($downloadBtn && $downloadBtn->href) { + $downloadLink = 'https://modbakery.donutteam.com' . $downloadBtn->href; + } + + // Build content + $content = ''; + + // Add banner + $content .= '
'; + $content .= 'Futurama: Hit & Run Banner'; + $content .= '

'; + + $content .= '

Version ' . htmlspecialchars($versionText) . '

'; + + // Add changelog if available + $changelogDetails = $versionBlock->find('details.component-details', 0); + if ($changelogDetails) { + $changelogContent = $changelogDetails->find('p.component-paragraph', 0); + if ($changelogContent) { + $content .= '

Changelog:

'; + $content .= '

' . $changelogContent->innertext . '

'; + } + } + + // Add download button + if ($downloadLink) { + $content .= '

Download Version ' . htmlspecialchars($versionText) . '

'; + } + + // Add project info + $content .= '

'; + $content .= '

Futurama: Hit & Run is a total conversion mod for The Simpsons: Hit & Run aiming to replicate the gameplay of Hit & Run in the world of Futurama.

'; + $content .= '

Developer: Slurm Team

'; + + $item['content'] = $content; + $item['author'] = 'Slurm Team'; + + // Add banner as enclosure + $item['enclosures'][] = 'https://nyc3.digitaloceanspaces.com/donut-team/files/2025/10/18/19-46-32/399a6671-8cf9-4aa0-b3d5-6cd8656f8a09/banner.webp'; + + $this->items[] = $item; + } + } + + public function getName() { + return 'Futurama: Hit & Run - Mod Releases'; + } +}