fastfeedparser 0.5.6__tar.gz → 0.5.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastfeedparser-0.5.6/src/fastfeedparser.egg-info → fastfeedparser-0.5.8}/PKG-INFO +1 -1
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/setup.cfg +1 -1
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/src/fastfeedparser/main.py +37 -3
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8/src/fastfeedparser.egg-info}/PKG-INFO +1 -1
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/LICENSE +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/README.md +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/pyproject.toml +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/src/fastfeedparser/__init__.py +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/src/fastfeedparser.egg-info/SOURCES.txt +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/src/fastfeedparser.egg-info/dependency_links.txt +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/src/fastfeedparser.egg-info/requires.txt +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/src/fastfeedparser.egg-info/top_level.txt +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/tests/test_encoding.py +0 -0
- {fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/tests/test_integration.py +0 -0
|
@@ -411,6 +411,13 @@ def _parse_json_feed(
|
|
|
411
411
|
if enclosures:
|
|
412
412
|
entry["enclosures"] = enclosures
|
|
413
413
|
|
|
414
|
+
# Derive feedparser-compatible author fields
|
|
415
|
+
_author = entry.get("author")
|
|
416
|
+
if _author:
|
|
417
|
+
_detail = {"name": _author}
|
|
418
|
+
entry["author_detail"] = _detail
|
|
419
|
+
entry["authors"] = [_detail]
|
|
420
|
+
|
|
414
421
|
# Add links
|
|
415
422
|
entry["links"] = []
|
|
416
423
|
item_url = item.get("url")
|
|
@@ -455,7 +462,14 @@ def _fetch_url_content(url: str) -> str | bytes:
|
|
|
455
462
|
)
|
|
456
463
|
content = brotli.decompress(content)
|
|
457
464
|
content_charset = response.headers.get_content_charset()
|
|
458
|
-
|
|
465
|
+
if content_charset:
|
|
466
|
+
try:
|
|
467
|
+
return content.decode(content_charset)
|
|
468
|
+
except (UnicodeDecodeError, LookupError):
|
|
469
|
+
# Server lied about charset; return raw bytes and let
|
|
470
|
+
# lxml detect encoding from the XML declaration/BOM.
|
|
471
|
+
return content
|
|
472
|
+
return content
|
|
459
473
|
|
|
460
474
|
|
|
461
475
|
def _maybe_parse_json_feed(
|
|
@@ -805,6 +819,12 @@ def _parse_content(
|
|
|
805
819
|
# Ensure that titles and descriptions are always present
|
|
806
820
|
entry["title"] = entry.get("title", "").strip()
|
|
807
821
|
entry["description"] = entry.get("description", "").strip()
|
|
822
|
+
# Derive feedparser-compatible author fields
|
|
823
|
+
_author = entry.get("author")
|
|
824
|
+
if _author:
|
|
825
|
+
_detail = {"name": _author}
|
|
826
|
+
entry["author_detail"] = _detail
|
|
827
|
+
entry["authors"] = [_detail]
|
|
808
828
|
entries.append(entry)
|
|
809
829
|
|
|
810
830
|
return feed
|
|
@@ -971,8 +991,19 @@ def _parse_feed_info(
|
|
|
971
991
|
for link in channel.findall(f"{{{atom_ns}}}link"):
|
|
972
992
|
rel = link.get("rel")
|
|
973
993
|
href = link.get("href") or link.get("link")
|
|
974
|
-
if rel
|
|
994
|
+
if rel == "alternate" and href and not feed_link:
|
|
975
995
|
feed_link = href
|
|
996
|
+
feed_links.append(
|
|
997
|
+
{
|
|
998
|
+
"rel": rel,
|
|
999
|
+
"type": link.get("type"),
|
|
1000
|
+
"href": href,
|
|
1001
|
+
"title": link.get("title"),
|
|
1002
|
+
}
|
|
1003
|
+
)
|
|
1004
|
+
elif rel is None and href:
|
|
1005
|
+
if not feed_link:
|
|
1006
|
+
feed_link = href
|
|
976
1007
|
elif rel not in {"hub", "self", "replies", "edit"}:
|
|
977
1008
|
feed_links.append(
|
|
978
1009
|
{
|
|
@@ -1114,7 +1145,10 @@ def _populate_entry_links_from_elements(
|
|
|
1114
1145
|
"title": link.get("title"),
|
|
1115
1146
|
}
|
|
1116
1147
|
if rel == "alternate":
|
|
1117
|
-
alternate_link
|
|
1148
|
+
if alternate_link is None:
|
|
1149
|
+
alternate_link = link_dict
|
|
1150
|
+
else:
|
|
1151
|
+
entry_links.append(link_dict)
|
|
1118
1152
|
elif rel not in {"edit", "self"}:
|
|
1119
1153
|
entry_links.append(link_dict)
|
|
1120
1154
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastfeedparser-0.5.6 → fastfeedparser-0.5.8}/src/fastfeedparser.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|