Neue Bridge für Dubesors LLM Benchmark Blog
This commit is contained in:
75
DubesorBridge.php
Normal file
75
DubesorBridge.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
class DubesorBridge extends BridgeAbstract
|
||||
{
|
||||
|
||||
const MAINTAINER = 'Brawl, Claude';
|
||||
const NAME = 'Dubesor LLM Benchmark First Impressions';
|
||||
const URI = 'https://dubesor.de/first-impressions';
|
||||
const CACHE_TIMEOUT = 43200; // 12h
|
||||
const DESCRIPTION = 'First impressions blog from Dubesor';
|
||||
|
||||
public function getIcon()
|
||||
{
|
||||
return 'https://dubesor.de/favicon.ico';
|
||||
}
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$pageUrl = $this->getURI();
|
||||
$html = getSimpleHTMLDOM($pageUrl)
|
||||
or returnServerError('Could not request webpage: ' . $pageUrl);
|
||||
|
||||
foreach ($html->find('.entry') as $element) {
|
||||
if (count($this->items) >= 20) {
|
||||
break;
|
||||
}
|
||||
|
||||
$modelTagsContainer = $element->find('.model-tags-container', 0);
|
||||
$dateElement = $element->find('.entry-date', 0);
|
||||
$contentElement = $element->find('.entry-content', 0);
|
||||
|
||||
if (!$modelTagsContainer || !$dateElement || !$contentElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$modelTags = $modelTagsContainer->find('.model-tag');
|
||||
$modelNames = array();
|
||||
foreach ($modelTags as $tag) {
|
||||
$modelNames[] = trim(strip_tags($tag->innertext));
|
||||
}
|
||||
|
||||
if (empty($modelNames)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$dateStr = trim(strip_tags($dateElement->innertext));
|
||||
$content = $contentElement->innertext;
|
||||
|
||||
$timestamp = strtotime($dateStr);
|
||||
$modelList = implode(', ', $modelNames);
|
||||
$title = 'First Impression: ' . $modelList;
|
||||
|
||||
$anchorLink = $modelTagsContainer->find('.anchor-link', 0);
|
||||
$anchorId = '';
|
||||
if ($anchorLink) {
|
||||
$href = $anchorLink->href;
|
||||
$anchorId = str_replace('#', '', $href);
|
||||
} else {
|
||||
$anchorId = strtolower(str_replace(' ', '-', $modelNames[0]));
|
||||
$anchorId = preg_replace('/[^a-z0-9\-]/', '', $anchorId);
|
||||
}
|
||||
|
||||
$uri = $this->getURI() . '#' . $anchorId;
|
||||
|
||||
$item = array();
|
||||
$item['uid'] = $uri;
|
||||
$item['uri'] = $uri;
|
||||
$item['title'] = $title;
|
||||
$item['content'] = $content;
|
||||
$item['timestamp'] = $timestamp;
|
||||
$item['author'] = 'Dubesor';
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user