mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 06:34:25 -04:00
allow passing import list via stdin
This commit is contained in:
parent
cb60bad1d7
commit
39f5e12364
2 changed files with 37 additions and 2 deletions
|
@ -180,6 +180,20 @@ def pretty_path(path):
|
|||
return path.replace(REPO_DIR + '/', '')
|
||||
|
||||
|
||||
def save_source(raw_text):
|
||||
if not os.path.exists(SOURCES_DIR):
|
||||
os.makedirs(SOURCES_DIR)
|
||||
|
||||
ts = str(datetime.now().timestamp()).split('.', 1)[0]
|
||||
|
||||
source_path = os.path.join(SOURCES_DIR, '{}-{}.txt'.format('stdin', ts))
|
||||
|
||||
with open(source_path, 'w', encoding='utf-8') as f:
|
||||
f.write(raw_text)
|
||||
|
||||
return source_path
|
||||
|
||||
|
||||
def download_url(url):
|
||||
"""download a given url's content into downloads/domain.txt"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue