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

Update TechCrunch #522

Merged
merged 2 commits into from
May 20, 2024
Merged

Update TechCrunch #522

merged 2 commits into from
May 20, 2024

Conversation

MaxDall
Copy link
Collaborator

@MaxDall MaxDall commented May 17, 2024

This PR:

  • upgrades TechCrunch to adapt the newest layout
  • fix a bug in the extraction of the previous version

@MaxDall MaxDall requested a review from addie9800 May 17, 2024 07:21
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 this


@attribute
def title(self) -> Optional[str]:
return self.precomputed.meta.get("og:title")
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 parse this from the JSON, since the og:title tag value has an extra | TechCrunch appended to the headline

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually the same problem also occurs with V1. Also, since (almost) only the selectors are changed, I think also a minor parser update (V1_1) would be enough to spare all the duplicate code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The headline referenced in the LD+JSON suffers from encoding problems. I left it as is and removed | TechCrunch

@@ -14,10 +14,42 @@


class TechCrunchParser(ParserProxy):
class V2(BaseParser):
_summary_selector: XPath = CSSSelector("div.entry-content > p#speakable-summary")
_paragraph_selector: XPath = CSSSelector("div.entry-content > p:not(#speakable-summary)")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to also parse bulletpoint lists? If so, I have found one usage: https://techcrunch.com/2024/05/15/senate-study-proposes-at-least-32b-yearly-for-ai-programs/

@MaxDall MaxDall requested a review from addie9800 May 18, 2024 12:50
@MaxDall MaxDall merged commit 10dfea4 into master May 20, 2024
5 checks passed
@MaxDall MaxDall deleted the update-tech-crunch branch May 20, 2024 19:56
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