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

Adjust paragraph selector for Fox News parser #368

Merged
merged 3 commits into from
Feb 24, 2024
Merged

Adjust paragraph selector for Fox News parser #368

merged 3 commits into from
Feb 24, 2024

Conversation

MaxDall
Copy link
Collaborator

@MaxDall MaxDall commented Feb 22, 2024

This adds a new summary selector as well as including paragraphs with optional div.paywall parent node.

@MaxDall MaxDall mentioned this pull request Feb 22, 2024
39 tasks
Copy link
Collaborator

@addie9800 addie9800 left a comment

Choose a reason for hiding this comment

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

Thanks for updating Fox :)

@@ -14,7 +14,7 @@

class FoxNewsParser(ParserProxy):
class V1(BaseParser):
_paragraph_selector = CSSSelector(".article-body > p")
_paragraph_selector = XPath("//div[@class='article-body'] / p[text()]")
Copy link
Collaborator

Choose a reason for hiding this comment

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

The new selector does not work on some articles: e.g. https://www.foxnews.com/politics/speaker-johnson-slams-desperate-biden-calling-gop-worse-segregationists-fundraiser and https://www.foxnews.com/world/putin-puts-west-notice-flight-nuclear-capable-bomber
It's a bit weird though, because they seem to be premium articles, but I am still able to access them, even from Edge where I don't have any blockers installed. The use a slightly different class in the div block 'article-content'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, the old selector would not have worked here either. The div.paywall wrapper seems to have been overlooked the first time this parser was added. Very nice you found this 👍
First, I thought loosening the child constraint > p -> p would be sufficient, but that usually results in adding more and more cases to filter. Instead, I will add an alternative part including the paywall.

src/fundus/publishers/us/fox_news.py Show resolved Hide resolved
@MaxDall MaxDall merged commit 790ad60 into master Feb 24, 2024
5 checks passed
@MaxDall MaxDall deleted the fix-fox branch February 24, 2024 16:10
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