-
Notifications
You must be signed in to change notification settings - Fork 107
Add German publisher T-Online #805
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,7 @@ | |
| from .wdr import WDRParser | ||
| from .winfuture import WinfutureParser | ||
| from .zdf import ZDFParser | ||
|
|
||
| from .t_online import TOnlineParser | ||
|
|
||
| # noinspection PyPep8Naming | ||
| class DE(metaclass=PublisherGroup): | ||
|
|
@@ -595,3 +595,12 @@ class DE(metaclass=PublisherGroup): | |
| Sitemap("https://www.gamestar.de/artikel_archiv_index.xml"), | ||
| ], | ||
| ) | ||
|
|
||
| TOnline = Publisher( | ||
| name="T-Online", | ||
| domain="https://www.t-online.de/", | ||
| parser=TOnlineParser, | ||
| sources=[ | ||
| Sitemap("https://www.t-online.de/sitemap.xml"), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Sitemap does not work. Use RSSFeeds from here instead: https://www.t-online.de/id_15610510/nachrichten-aus-aller-welt-dank-rss-feeds-von-t-online-de-immer-auf-dem-laufenden.html |
||
| ], | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| 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, | ||
| ) | ||
|
|
||
|
|
||
| class TOnlineParser(ParserProxy): | ||
| class V1(BaseParser): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are missing the |
||
| _paragraph_selector = CSSSelector("div[class*='px-24'] > p.text-18") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to rework all the selectors, they do not seem to work. |
||
| _summary_selector = CSSSelector("p.font-bold.text-18") | ||
| _subheadline_selector = CSSSelector("h3, h2") | ||
|
|
||
| @attribute | ||
| def body(self) -> Optional[ArticleBody]: | ||
| return extract_article_body_with_selector( | ||
| self.precomputed.doc, | ||
| summary_selector=self._summary_selector, | ||
| subheadline_selector=self._subheadline_selector, | ||
| paragraph_selector=self._paragraph_selector, | ||
| ) | ||
|
|
||
| @attribute | ||
| def publishing_date(self) -> Optional[datetime.datetime]: | ||
| return generic_date_parsing(self.precomputed.ld.bf_search("datePublished")) | ||
|
|
||
| @attribute | ||
| def authors(self) -> List[str]: | ||
| return generic_author_parsing(self.precomputed.ld.bf_search("author")) | ||
|
|
||
| @attribute | ||
| def title(self) -> Optional[str]: | ||
| return self.precomputed.ld.bf_search("headline") | ||
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.
As soon as you're done implementing this parser, please follow these steps to generate the test files. Make sure that the test article includes, topics, images and subheadlines.