fix(codeberg): semi-fix parsing of pull requests (#3916)

This commit is contained in:
Dag 2024-01-23 22:25:43 +01:00 committed by GitHub
parent bd58266b80
commit 4986119f1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -275,22 +275,26 @@ class CodebergBridge extends BridgeAbstract
*/ */
private function extractPulls($html) private function extractPulls($html)
{ {
$div = $html->find('div.issue.list', 0); $div = $html->find('div#issue-list', 0);
foreach ($div->find('li.item') as $li) { $var2 = $div->find('div.flex-item');
foreach ($var2 as $li) {
$item = []; $item = [];
$number = trim($li->find('a.index,ml-0.mr-2', 0)->plaintext); $number = trim($li->find('a.index,ml-0.mr-2', 0)->plaintext);
$item['title'] = $li->find('a.title', 0)->plaintext . ' (' . $number . ')'; $a = $li->find('a.issue-title', 0);
$item['uri'] = $li->find('a.title', 0)->href; $item['title'] = $a->plaintext . ' (' . $number . ')';
$item['uri'] = $a->href;
$time = $li->find('relative-time.time-since', 0); $time = $li->find('relative-time.time-since', 0);
if ($time) { if ($time) {
$item['timestamp'] = $time->datetime; $item['timestamp'] = $time->datetime;
} }
$item['author'] = $li->find('div.desc', 0)->find('a', 1)->plaintext; // Extracting the author is a bit awkward after they changed their html
//$desc = $li->find('div.desc', 0);
//$item['author'] = $desc->find('a', 1)->plaintext;
// Fetch pull request page // Fetch pull request page
$pullRequestPage = getSimpleHTMLDOMCached($item['uri'], 3600); $pullRequestPage = getSimpleHTMLDOMCached($item['uri'], 3600);