Skip to content

Commit

Permalink
[Usenix] Add new bridge for USENIX (usenix.org) publications (RSS-Bri…
Browse files Browse the repository at this point in the history
…dge#2772)

Currently only supporting the ;login: publication.
  • Loading branch information
dvikan authored Jun 8, 2022
1 parent 12ddee4 commit baa4ea8
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions bridges/UsenixBridge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);

final class UsenixBridge extends BridgeAbstract
{
const NAME = 'USENIX';
const URI = 'https://www.usenix.org/publications';
const DESCRIPTION = 'Digital publications from USENIX (usenix.org)';
const MAINTAINER = 'dvikan';
const PARAMETERS = [
'USENIX ;login:' => [
],
];

public function collectData()
{
if ($this->queriedContext === 'USENIX ;login:') {
$this->collectLoginOnlineItems();
return;
}
throw new Exception('Illegal context');
}

private function collectLoginOnlineItems(): void
{
$url = 'https://www.usenix.org/publications/loginonline';
$dom = getSimpleHTMLDOMCached($url);
$items = $dom->find('div.view-content > div');

foreach ($items as $item) {
$title = $item->find('.views-field-title > span', 0);
$relativeUrl = $item->find('.views-field-nothing-1 > span > a', 0);
// June 2, 2022
$createdAt = $item->find('div.views-field-field-lv2-publication-date > div > span', 0);

$this->items[] = [
'title' => $title->innertext,
'uri' => sprintf('https://www.usenix.org%s', $relativeUrl->href),
'timestamp' => $createdAt->innertext,
'content' => $item->find('.views-field-field-lv2-article-teaser > div', 0)->innertext,
];
}
}
}

0 comments on commit baa4ea8

Please sign in to comment.