[ 'name' => 'Cosplayer ID', 'type' => 'number', 'required' => true, 'title' => 'Enter the Cosplayer ID (e.g., 95 from https://galleryepic.com/en/coser/95/1)', 'exampleValue' => 95 ] ] ]; const CACHE_TIMEOUT = 21600; // 6 hours private $feedName = null; public function collectData() { $cosplayerId = $this->getInput('cosplayer_id'); if (!$cosplayerId) { returnServerError('Cosplayer ID is required.'); } // Set a default feed name before fetching content $this->feedName = static::NAME . ' for Cosplayer ID ' . $cosplayerId; $url = self::URI . 'en/coser/' . $cosplayerId . '/1'; $html = getSimpleHTMLDOM($url); if (!$html) { returnServerError('Could not request_uri: ' . $url); } // Extract cosplayer name for a more specific feed title $cosplayerNameElement = $html->find('h4.scroll-m-20.text-xl.font-semibold.tracking-tight', 0); if ($cosplayerNameElement) { $cosplayerName = trim($cosplayerNameElement->plaintext); $this->feedName = $cosplayerName . ' - GalleryEpic Albums'; } else { // Fallback if name couldn't be extracted, keep the default with ID $this->feedName = 'GalleryEpic Albums for Cosplayer ID ' . $cosplayerId; } $albums = $html->find('div.space-y-3.relative'); foreach ($albums as $albumElement) { $item = []; $linkElement = $albumElement->find('a.space-y-3', 0); if ($linkElement) { $item['uri'] = self::URI . ltrim($linkElement->href, '/'); } $titleElement = $albumElement->find('h3.font-medium', 0); if ($titleElement) { $item['title'] = $titleElement->plaintext; } $seriesElement = $albumElement->find('p.text-xs.text-muted-foreground', 0); $seriesText = $seriesElement ? $seriesElement->plaintext : ''; $imageElement = $albumElement->find('img[variant="cover"]', 0); $imageUrl = $imageElement ? $imageElement->src : ''; $imagePCountElement = $albumElement->find('p.absolute.bottom-2.right-2', 0); $imagePCount = $imagePCountElement ? str_replace('P', '', $imagePCountElement->plaintext) : ''; $item['content'] = '
';
if ($seriesText) {
$item['content'] .= 'Series: ' . $seriesText . '
';
}
if ($imagePCount) {
$item['content'] .= 'Pictures: ' . $imagePCount . '
';
}
$item['content'] .= '