-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: Add AAAI as a new data source
- Loading branch information
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from typing import Any | ||
|
||
from scrapy.http import HtmlResponse | ||
|
||
from app.source.base import PaperRequestsTask | ||
|
||
import xml.dom.minidom | ||
|
||
|
||
class AAAI(PaperRequestsTask): | ||
url: str = ( | ||
"https://dblp.uni-trier.de/search/publ/api?q=toc%3Adb/conf/aaai/aaai2023.bht%3A&h=1000&format=xml" | ||
) | ||
name: str = "AAAI" | ||
|
||
@staticmethod | ||
def parse_urls(response: HtmlResponse) -> list[str]: | ||
_xml = response.text | ||
domTree = xml.dom.minidom.parseString(_xml) | ||
collection = domTree.documentElement | ||
|
||
hits = collection.getElementsByTagName("hit") | ||
urls = [] | ||
for hit in hits: | ||
url = hit.getElementsByTagName("ee")[0] | ||
urls.append(url.childNodes[0].data) | ||
return urls | ||
|
||
@staticmethod | ||
def parse(response: HtmlResponse): | ||
item = { | ||
"title": response.css("h1.page_title::text").get().strip(), # type: ignore | ||
"abstract": response.css("section.abstract::text").getall()[1].strip(), # type: ignore | ||
"url": response.css("a.pdf::attr(href)").get(), | ||
"keywords": response.css("section.keywords span.value::text") | ||
.get() | ||
.replace("\t", "") # type: ignore | ||
.replace("\n", "") | ||
.split(", "), | ||
"authors": response.css("span.name::text").getall(), | ||
} | ||
|
||
return item | ||
|
||
@staticmethod | ||
def post_parse(item: dict[str, Any]) -> dict[str, Any]: | ||
if item["authors"] is not None: | ||
for i, author in enumerate(item["authors"]): | ||
item["authors"][i] = author.strip() | ||
return item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
from app.source.AAAI import AAAI | ||
from app.source.Arxiv import Arxiv | ||
from app.source.ICLR import ICLR | ||
from app.source.ICML import ICML | ||
from app.source.NIPS import NIPS | ||
from app.source.PMLR import PMLR | ||
|
||
__all__ = ["NIPS", "ICLR", "ICML", "Arxiv"] | ||
__all__ = ["NIPS", "ICLR", "ICML", "Arxiv", "AAAI", "PMLR"] |