Skip to content
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

Fix Sportschau #611

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Fix Sportschau #611

merged 1 commit into from
Sep 13, 2024

Conversation

addie9800
Copy link
Collaborator

The former summary selector was too broad, causing errors when paring articles like this one: https://www.sportschau.de/fussball/nationsleague/ein-wechselspiel-aus-licht-und-schatten,einzelkritik-dfb-102.html . The parsing crashed because the summary nodes are not restricted to the beginning of the article.

Comment on lines +17 to 20
_summary_selector = CSSSelector(
"p[class='textabsatz columns twelve m-ten m-offset-one l-eight l-offset-two']" " > strong"
)
_paragraph_selector = CSSSelector("article >p.textabsatz:not(p.textabsatz:nth-of-type(1))")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest these two selectors as it seems the summary is always the first paragraph:

_paragraph_selector = XPath("//article/p[position() > 1]")
_summary_selector = XPath("//article/p[1]")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that unfortunately that does not always hold, since they also include a wide variety of other sources. E.g. this article from RBB does not include any summary: https://www.sportschau.de/regional/rbb/rbb-fussball-ex-nationalspieler-nico-schulz-spielt-ab-sofort-bei-tuerkischem-zweitligisten-100.html

@addie9800 addie9800 merged commit 0f771e4 into master Sep 13, 2024
5 checks passed
@addie9800 addie9800 deleted the fix-sportschau branch September 13, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants