fix: rewrite and improve caching (#3594)

This commit is contained in:
Dag 2023-09-10 21:50:15 +02:00 committed by GitHub
parent a786bbd4e0
commit 4b9f6f7e53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 993 additions and 1169 deletions

View file

@ -33,6 +33,7 @@ class AO3Bridge extends BridgeAbstract
],
]
];
private $title;
public function collectData()
{
@ -94,11 +95,12 @@ class AO3Bridge extends BridgeAbstract
$url = self::URI . "/works/$id/navigate";
$httpClient = RssBridge::getHttpClient();
$version = 'v0.0.1';
$response = $httpClient->request($url, [
'useragent' => 'rss-bridge bot (https://github.com/RSS-Bridge/rss-bridge)',
'useragent' => "rss-bridge $version (https://github.com/RSS-Bridge/rss-bridge)",
]);
$html = \str_get_html($response['body']);
$html = \str_get_html($response->getBody());
$html = defaultLinkTo($html, self::URI);
$this->title = $html->find('h2 a', 0)->plaintext;