mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-31 18:11:53 +02:00
save command versions in archive results
This commit is contained in:
@@ -35,6 +35,11 @@ from config import (
|
|||||||
WGET_USER_AGENT,
|
WGET_USER_AGENT,
|
||||||
CHECK_SSL_VALIDITY,
|
CHECK_SSL_VALIDITY,
|
||||||
COOKIES_FILE,
|
COOKIES_FILE,
|
||||||
|
CURL_VERSION,
|
||||||
|
WGET_VERSION,
|
||||||
|
CHROME_VERSION,
|
||||||
|
GIT_VERSION,
|
||||||
|
YOUTUBEDL_VERSION,
|
||||||
)
|
)
|
||||||
from util import (
|
from util import (
|
||||||
domain,
|
domain,
|
||||||
@@ -42,7 +47,6 @@ from util import (
|
|||||||
without_query,
|
without_query,
|
||||||
without_fragment,
|
without_fragment,
|
||||||
fetch_page_title,
|
fetch_page_title,
|
||||||
read_js_script,
|
|
||||||
is_static_file,
|
is_static_file,
|
||||||
TimedProgress,
|
TimedProgress,
|
||||||
chmod_file,
|
chmod_file,
|
||||||
@@ -59,19 +63,7 @@ from logs import (
|
|||||||
log_archive_method_finished,
|
log_archive_method_finished,
|
||||||
)
|
)
|
||||||
|
|
||||||
class ArchiveError(Exception):
|
|
||||||
def __init__(self, message, hints=None):
|
|
||||||
super().__init__(message)
|
|
||||||
self.hints = hints
|
|
||||||
|
|
||||||
class ArchiveResult(NamedTuple):
|
|
||||||
cmd: List[str]
|
|
||||||
pwd: str
|
|
||||||
output: Union[str, Exception, None]
|
|
||||||
status: str
|
|
||||||
start_ts: datetime
|
|
||||||
end_ts: datetime
|
|
||||||
duration: int
|
|
||||||
|
|
||||||
|
|
||||||
def archive_link(link_dir: str, link: Link, page=None) -> Link:
|
def archive_link(link_dir: str, link: Link, page=None) -> Link:
|
||||||
@@ -165,6 +157,7 @@ def fetch_title(link_dir: str, link: Link, timeout: int=TIMEOUT) -> ArchiveResul
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=CURL_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -203,6 +196,7 @@ def fetch_favicon(link_dir: str, link: Link, timeout: int=TIMEOUT) -> ArchiveRes
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=CURL_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -289,6 +283,7 @@ def fetch_wget(link_dir: str, link: Link, timeout: int=TIMEOUT) -> ArchiveResult
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=WGET_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -332,6 +327,7 @@ def fetch_pdf(link_dir: str, link: Link, timeout: int=TIMEOUT) -> ArchiveResult:
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=CHROME_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -374,6 +370,7 @@ def fetch_screenshot(link_dir: str, link: Link, timeout: int=TIMEOUT) -> Archive
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=CHROME_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -418,6 +415,7 @@ def fetch_dom(link_dir: str, link: Link, timeout: int=TIMEOUT) -> ArchiveResult:
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=CHROME_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -475,6 +473,7 @@ def fetch_git(link_dir: str, link: Link, timeout: int=TIMEOUT) -> ArchiveResult:
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=GIT_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -546,6 +545,7 @@ def fetch_media(link_dir: str, link: Link, timeout: int=MEDIA_TIMEOUT) -> Archiv
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=YOUTUBEDL_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
@@ -611,6 +611,7 @@ def archive_dot_org(link_dir: str, link: Link, timeout: int=TIMEOUT) -> ArchiveR
|
|||||||
return ArchiveResult(
|
return ArchiveResult(
|
||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
pwd=link_dir,
|
pwd=link_dir,
|
||||||
|
cmd_version=CURL_VERSION,
|
||||||
output=output,
|
output=output,
|
||||||
status=status,
|
status=status,
|
||||||
**timer.stats,
|
**timer.stats,
|
||||||
|
Reference in New Issue
Block a user