From baa4ea83384180a6b41bf7625c5e66753f33fda9 Mon Sep 17 00:00:00 2001 From: Dag Date: Wed, 8 Jun 2022 05:43:56 +0200 Subject: [PATCH] [Usenix] Add new bridge for USENIX (usenix.org) publications (#2772) Currently only supporting the ;login: publication. --- bridges/UsenixBridge.php | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 bridges/UsenixBridge.php diff --git a/bridges/UsenixBridge.php b/bridges/UsenixBridge.php new file mode 100644 index 00000000..064f7d3f --- /dev/null +++ b/bridges/UsenixBridge.php @@ -0,0 +1,44 @@ + [ + ], + ]; + + 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, + ]; + } + } +}