0
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-06-29 18:21:07 +00:00

fix(github): PRs and issues (#4544)

This commit is contained in:
Dag 2025-05-09 00:09:28 +02:00 committed by GitHub
parent 58e30f8b4b
commit 9dc673a038
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -200,11 +200,14 @@ class GithubIssueBridge extends BridgeAbstract
$this->items = $this->extractIssueComments($html);
break;
case static::BRIDGE_OPTIONS[0]: // Project Issues
// PRs
$issues = $html->find('.js-active-navigation-container .js-navigation-item');
$issues = $html->find('.IssueRow-module__row--XmR1f');
foreach ($issues as $issue) {
$info = $issue->find('.issue-item-module__authorCreatedLink--wFZvk', 0);
if (!$issues) {
// Issues
$issues = $html->find('.IssueRow-module__row--XmR1f');
}
foreach ($issues as $issue) {
preg_match('/\/([0-9]+)$/', $issue->find('a', 0)->href, $match);
$issueNbr = $match[1];
@ -214,6 +217,7 @@ class GithubIssueBridge extends BridgeAbstract
if ($this->getInput('c')) {
$uri = static::URI . $this->getInput('u')
. '/' . $this->getInput('p') . '/' . static::URL_PATH . '/' . $issueNbr;
$issue = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT);
if ($issue) {
$this->items = array_merge(
@ -226,15 +230,25 @@ class GithubIssueBridge extends BridgeAbstract
}
$item['author'] = $issue->find('a', 1)->plaintext;
$item['timestamp'] = strtotime(
$issue->find('relative-time', 0)->getAttribute('datetime')
);
$item['title'] = html_entity_decode(
$issue->find('h3', 0)->plaintext,
ENT_QUOTES,
'UTF-8'
);
$time = $issue->find('relative-time', 0);
$datetime = $time->getAttribute('datetime');
if ($datetime) {
$item['timestamp'] = strtotime($datetime);
}
$item['title'] = '';
# Works for PRs
$title = $issue->find('a.Link--primary', 0);
if ($title) {
$item['title'] = html_entity_decode($title->plaintext, ENT_QUOTES, 'UTF-8');
}
$title2 = $issue->find('h3 a', 0);
if ($title2) {
$item['title'] = html_entity_decode($title2->plaintext, ENT_QUOTES, 'UTF-8');
}
//$comment_count = 0;
//if ($span = $issue->find('a[aria-label*="comment"] span', 0)) {
// $comment_count = $span->plaintext;