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

fixes for JSONfeed item.content #439

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

bbolli
Copy link
Contributor

@bbolli bbolli commented Apr 22, 2024

After trying to parse the first JSON feed I found in the wild [1], I realized that the content element should be a list. This series fixes this defect and prefers HTML content over text.

[1] https://leahneukirchen.org/trivium/index.json

The spec allows to have both text and HTML elements, and the feedparser
content key supports different content types.

Adjust the code to look at both source elements and add all that are
present.

Signed-off-by: Beat Bolli <[email protected]>
HTML has generally more useful information than text, so let's move it
first in the content list. Users that want text can still iterate over
the list and pick the text type.

Signed-off-by: Beat Bolli <[email protected]>
The spec says that at least one element is mandatory. Verify this and
raise an exception if both are missing.

Signed-off-by: Beat Bolli <[email protected]>
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.

None yet

1 participant