Skip to content

Conversation

@LiamVDB1
Copy link

This pull request introduces support for handling articles within the timeline data structure. It includes changes to add new interfaces for articles, parse article data into markdown, and integrate articles into existing tweet parsing functionality.

Article Support Enhancements:

  • New Interfaces for Articles:

    • Added ArticleRaw, ArticleResultRaw, ArticleContentStateRaw, and related interfaces to represent article data, including metadata, media, and content state. (src/timeline-v1.ts, src/timeline-v1.tsR122-R194)
    • Updated SearchResultRaw and TimelineResultRaw to include an optional article field for article data. (src/timeline-v1.ts, [1] [2]
  • Article Parsing Logic:

    • Implemented parseArticleToMarkdown to convert article content into markdown format, handling text, links, styles, headers, lists, and media. (src/timeline-v2.ts, src/timeline-v2.tsR261-R393)
    • Added parseArticle function to map raw article data to the new Article interface, including extracting cover media details. (src/timeline-v2.ts, src/timeline-v2.tsR261-R393)
  • Integration with Timeline Parsing:

    • Updated parseResult to detect and process articles within timeline results, converting them to markdown and integrating them into the Tweet structure. (src/timeline-v2.ts, src/timeline-v2.tsR419-R425)

Tweet Interface Updates:

  • Support for Articles in Tweets:
    • Extended the Tweet interface to include isArticle and article fields, enabling tweets to reference associated article data. (src/tweets.ts, src/tweets.tsR79-R80)
    • Added a new Article interface to define the structure of article data within tweets. (src/tweets.ts, src/tweets.tsR40-R46)

@karashiiro karashiiro self-assigned this Jul 12, 2025
@karashiiro karashiiro added the enhancement New feature or request label Jul 12, 2025
…on not available), only parse Article from `TweetDetail` endpoint.
Copy link
Collaborator

@karashiiro karashiiro left a comment

Choose a reason for hiding this comment

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

Sorry it took so long for me to get around to this - could you add one or two basic tests to tweets.test.ts to validate that article parsing works at a basic level? It should be enough to just find a couple tweets with articles and check that the output is what we should expect it to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants