-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Rheinische Post
as publisher
#416
Merged
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8854b21
add `Rheinische Post` as publisher
MaxDall 65fe4cd
update supported_publishers.md
MaxDall ccefb98
Merge branch 'flairNLP:master' into add-rheineische-post
MaxDall 98513f4
add `RSSFeed` and subheadline selector
MaxDall d3b01e1
test commit back to fork
MaxDall a12a3ea
Merge branch 'flairNLP:master' into add-rheineische-post
MaxDall ee048cd
Update documentation from @ 24da82146e8dc89cdfefc96ea036944627e4048d
MaxDall 68173df
rewind changes
MaxDall a2180fa
Merge branch 'flairNLP:master' into add-rheineische-post
MaxDall 752dc8d
this should require an approval
MaxDall 170fe4a
Merge branch 'flairNLP:master' into add-rheineische-post
MaxDall 0f4c546
Update documentation from @ 2061960df3a5772a8298da3e27ffcf694029cb35
MaxDall a034eca
revert changes
MaxDall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,42 @@ | ||
import datetime | ||
from typing import List, Optional | ||
|
||
from lxml.cssselect import CSSSelector | ||
|
||
from fundus.parser import ArticleBody, BaseParser, ParserProxy, attribute | ||
from fundus.parser.utility import ( | ||
extract_article_body_with_selector, | ||
generic_author_parsing, | ||
generic_date_parsing, | ||
generic_topic_parsing, | ||
) | ||
|
||
|
||
class RheinischePostParser(ParserProxy): | ||
class V1(BaseParser): | ||
_summary_selector = CSSSelector("strong[data-cy='intro']") | ||
_paragraph_selector = CSSSelector("div[data-cy='article-content'] p") | ||
|
||
addie9800 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@attribute | ||
def body(self) -> ArticleBody: | ||
return extract_article_body_with_selector( | ||
self.precomputed.doc, | ||
summary_selector=self._summary_selector, | ||
paragraph_selector=self._paragraph_selector, | ||
) | ||
|
||
@attribute | ||
def authors(self) -> List[str]: | ||
return generic_author_parsing(self.precomputed.meta.get("author")) | ||
|
||
@attribute | ||
def publishing_date(self) -> Optional[datetime.datetime]: | ||
return generic_date_parsing(self.precomputed.ld.bf_search("datePublished")) | ||
|
||
@attribute | ||
def title(self) -> Optional[str]: | ||
return self.precomputed.meta.get("og:title") | ||
|
||
@attribute | ||
def topics(self) -> List[str]: | ||
return generic_topic_parsing(self.precomputed.meta.get("keywords")) |
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,22 @@ | ||
{ | ||
"V1": { | ||
"authors": [ | ||
"Simon Janßen" | ||
], | ||
"publishing_date": "2024-04-15 16:37:00+02:00", | ||
"title": "Schomaker an der Niederstraße: Bio-Bäckerei schließt Filiale in Neuss", | ||
"topics": [ | ||
"Schomaker", | ||
"Neuss", | ||
"Bio", | ||
"Niederstraße", | ||
"Schließung", | ||
"Reißleine", | ||
"Backwaren", | ||
"Bäcker", | ||
"begründet", | ||
"Biobäckerei", | ||
"Bäckereien" | ||
] | ||
} | ||
} |
Binary file added
BIN
+27.4 KB
tests/resources/parser/test_data/de/RheinischePost_2024_04_15.html.gz
Binary file not shown.
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add an RSSFeed from here as well.