Skip to content

Commit

Permalink
fixup! Mutualize getting ArcWarcRecord content
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Jan 25, 2024
1 parent 990ea36 commit a597f3a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/warc2zim/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from warc2zim.items import StaticArticle, WARCPayloadItem
from warc2zim.url_rewriting import FUZZY_RULES, normalize
from warc2zim.utils import (
get_arc_warc_record_content,
get_record_content,
get_record_mime_type,
get_record_url,
get_version,
Expand Down Expand Up @@ -327,7 +327,7 @@ def gather_information_from_warc(self):
main_page_found = True
continue

content = get_arc_warc_record_content(record)
content = get_record_content(record)

if not self.title:
self.title = parse_title(content)
Expand Down Expand Up @@ -417,7 +417,7 @@ def retrieve_illustration(self):
"Illustration_48x48_at_1"
]
return
self.illustration = get_arc_warc_record_content(record)
self.illustration = get_record_content(record)

Check warning on line 420 in src/warc2zim/converter.py

View check run for this annotation

Codecov / codecov/patch

src/warc2zim/converter.py#L420

Added line #L420 was not covered by tests

# favicon_url not in WARC ; downloading
try:
Expand Down
4 changes: 2 additions & 2 deletions src/warc2zim/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from warc2zim.content_rewriting.js import JsRewriter
from warc2zim.url_rewriting import ArticleUrlRewriter
from warc2zim.utils import (
get_arc_warc_record_content,
get_record_content,
get_record_mime_type,
get_record_url,
)
Expand All @@ -44,7 +44,7 @@ def __init__(
self.path = path
self.mimetype = get_record_mime_type(record)
self.title = ""
self.content = get_arc_warc_record_content(record)
self.content = get_record_content(record)

if getattr(record, "method", "GET") == "POST":
return
Expand Down
2 changes: 1 addition & 1 deletion src/warc2zim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def to_string(input_: str | bytes) -> str:
return input_ # pyright: ignore[reportGeneralTypeIssues, reportReturnType]


def get_arc_warc_record_content(record: ArcWarcRecord):
def get_record_content(record: ArcWarcRecord):
if hasattr(record, "buffered_stream"):
stream = (
record.buffered_stream # pyright: ignore [reportGeneralTypeIssues, reportAttributeAccessIssue]
Expand Down

0 comments on commit a597f3a

Please sign in to comment.