mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-01 02:52:55 +00:00
fix(github): PRs and issues (#4544)
This commit is contained in:
parent
58e30f8b4b
commit
9dc673a038
@ -200,11 +200,14 @@ class GithubIssueBridge extends BridgeAbstract
|
|||||||
$this->items = $this->extractIssueComments($html);
|
$this->items = $this->extractIssueComments($html);
|
||||||
break;
|
break;
|
||||||
case static::BRIDGE_OPTIONS[0]: // Project Issues
|
case static::BRIDGE_OPTIONS[0]: // Project Issues
|
||||||
|
// PRs
|
||||||
$issues = $html->find('.js-active-navigation-container .js-navigation-item');
|
$issues = $html->find('.js-active-navigation-container .js-navigation-item');
|
||||||
|
if (!$issues) {
|
||||||
|
// Issues
|
||||||
$issues = $html->find('.IssueRow-module__row--XmR1f');
|
$issues = $html->find('.IssueRow-module__row--XmR1f');
|
||||||
foreach ($issues as $issue) {
|
}
|
||||||
$info = $issue->find('.issue-item-module__authorCreatedLink--wFZvk', 0);
|
|
||||||
|
|
||||||
|
foreach ($issues as $issue) {
|
||||||
preg_match('/\/([0-9]+)$/', $issue->find('a', 0)->href, $match);
|
preg_match('/\/([0-9]+)$/', $issue->find('a', 0)->href, $match);
|
||||||
$issueNbr = $match[1];
|
$issueNbr = $match[1];
|
||||||
|
|
||||||
@ -214,6 +217,7 @@ class GithubIssueBridge extends BridgeAbstract
|
|||||||
if ($this->getInput('c')) {
|
if ($this->getInput('c')) {
|
||||||
$uri = static::URI . $this->getInput('u')
|
$uri = static::URI . $this->getInput('u')
|
||||||
. '/' . $this->getInput('p') . '/' . static::URL_PATH . '/' . $issueNbr;
|
. '/' . $this->getInput('p') . '/' . static::URL_PATH . '/' . $issueNbr;
|
||||||
|
|
||||||
$issue = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT);
|
$issue = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT);
|
||||||
if ($issue) {
|
if ($issue) {
|
||||||
$this->items = array_merge(
|
$this->items = array_merge(
|
||||||
@ -226,15 +230,25 @@ class GithubIssueBridge extends BridgeAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
$item['author'] = $issue->find('a', 1)->plaintext;
|
$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;
|
//$comment_count = 0;
|
||||||
//if ($span = $issue->find('a[aria-label*="comment"] span', 0)) {
|
//if ($span = $issue->find('a[aria-label*="comment"] span', 0)) {
|
||||||
// $comment_count = $span->plaintext;
|
// $comment_count = $span->plaintext;
|
||||||
|
Loading…
Reference in New Issue
Block a user