-
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.
Add ICLR and ICML sources, and feedparser dependency
- Loading branch information
Showing
10 changed files
with
161 additions
and
17 deletions.
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
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,64 @@ | ||
import logging | ||
import re | ||
from typing import Any | ||
|
||
from scrapy.http import HtmlResponse | ||
|
||
from app.source.base import PaperRequestsTask, RSSTask | ||
|
||
|
||
class Arxiv(RSSTask): | ||
url: str = "http://export.arxiv.org/rss/cs" | ||
name: str = "Arxiv" | ||
_cache_category_map: dict[str, str] = {} | ||
|
||
@staticmethod | ||
def parse(entry: dict) -> dict[str, Any]: | ||
return { | ||
"title": entry["title"], | ||
"authors": entry["author"], | ||
"url": entry["link"], | ||
"abstract": entry["summary"], | ||
} | ||
|
||
@property | ||
def category_map(self): | ||
if not self._cache_category_map: | ||
response = PaperRequestsTask._request( | ||
"https://arxiv.org/category_taxonomy", | ||
) | ||
if response is None: | ||
return {} | ||
response = HtmlResponse( | ||
url="", | ||
body=response.text, | ||
encoding="utf-8", | ||
) | ||
category = response.css("h4::text").getall() | ||
full_name = response.css("span::text").getall() | ||
for i, c in enumerate(category): | ||
self._cache_category_map[c] = ( | ||
full_name[i].replace("(", "").replace(")", "") | ||
) | ||
|
||
return self._cache_category_map | ||
|
||
def post_parse(self, entry: dict[str, Any]) -> dict[str, Any]: | ||
entry["title"] = entry["title"].split("(", 1)[0] | ||
entry["authors"] = ( | ||
HtmlResponse(url="", body=entry["authors"], encoding="utf-8") | ||
.css("a::text") | ||
.getall() | ||
) | ||
entry["abstract"] = ( | ||
HtmlResponse(url="", body=entry["abstract"], encoding="utf-8") | ||
.css("p::text") | ||
.get() | ||
) | ||
category = re.findall(r"\[(.*?)\]", entry["title"])[0] | ||
if category in Arxiv.category_map: | ||
entry["category"] = self.category_map[category] | ||
else: | ||
logging.warning(f"Unknown category: {category}") | ||
entry["category"] = None | ||
return entry |
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,6 @@ | ||
from app.source import NIPS | ||
|
||
|
||
class ICLR(NIPS): | ||
url: str = "https://iclr.cc/Conferences/2023/Schedule?type=Poster" | ||
name: str = "ICLR" |
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,6 @@ | ||
from app.source import NIPS | ||
|
||
|
||
class ICML(NIPS): | ||
url: str = "https://icml.cc/Conferences/2023/Schedule?type=Poster" | ||
name: str = "ICML" |
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
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,4 +1,6 @@ | ||
from app.source.base import PaperRequestsTask | ||
from app.source.NIPS import Nips | ||
from app.source.ICLR import ICLR | ||
from app.source.ICML import ICML | ||
from app.source.NIPS import NIPS | ||
|
||
__all__ = ["PaperRequestsTask", "Nips"] | ||
__all__ = ["PaperRequestsTask", "NIPS", "ICLR", "ICML"] |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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