pywaybackup 1.2.6__tar.gz → 1.3.1__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.
- {pywaybackup-1.2.6/pywaybackup.egg-info → pywaybackup-1.3.1}/PKG-INFO +5 -1
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/README.md +4 -0
- pywaybackup-1.3.1/pywaybackup/__version__.py +1 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/archive.py +18 -9
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/arguments.py +3 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/main.py +12 -5
- {pywaybackup-1.2.6 → pywaybackup-1.3.1/pywaybackup.egg-info}/PKG-INFO +5 -1
- pywaybackup-1.2.6/pywaybackup/__version__.py +0 -1
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/.github/ISSUE_TEMPLATE/bug.md +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/.gitignore +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/LICENSE +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/dev/pip_build.sh +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/dev/venv_create.sh +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/Exception.py +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/SnapshotCollection.py +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/Verbosity.py +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/__init__.py +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup/helper.py +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup.egg-info/SOURCES.txt +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup.egg-info/dependency_links.txt +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup.egg-info/entry_points.txt +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup.egg-info/requires.txt +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/pywaybackup.egg-info/top_level.txt +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/requirements.txt +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/setup.cfg +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/setup.py +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/test/cdx.example.com.200 +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/test/cdx.example.com.404 +0 -0
- {pywaybackup-1.2.6 → pywaybackup-1.3.1}/test/cdx.example.com.small.200 +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pywaybackup
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Download snapshots from the Wayback Machine
|
|
5
5
|
Home-page: https://github.com/bitdruid/python-wayback-machine-downloader
|
|
6
6
|
Author: bitdruid
|
|
@@ -102,6 +102,10 @@ Path defaults to output-dir. Saves the result of CDX query as a file. Useful for
|
|
|
102
102
|
- **`--cdxinject`** `<filepath>`:<br>
|
|
103
103
|
Injects a CDX query file to download snapshots. Ensure the query matches the previous `--url` for correct folder structure.
|
|
104
104
|
|
|
105
|
+
**Auto:**
|
|
106
|
+
- **`--auto`**:<br>
|
|
107
|
+
If set, csv, skip and cdxbackup/cdxinject are handled automatically. Keep the files and folders as they are. Otherwise they will not be recognized when restarting a download.
|
|
108
|
+
|
|
105
109
|
### Debug
|
|
106
110
|
|
|
107
111
|
- `--debug`: If set, full traceback will be printed in case of an error. The full exception will be written into `waybackup_error.log`.
|
|
@@ -86,6 +86,10 @@ Path defaults to output-dir. Saves the result of CDX query as a file. Useful for
|
|
|
86
86
|
- **`--cdxinject`** `<filepath>`:<br>
|
|
87
87
|
Injects a CDX query file to download snapshots. Ensure the query matches the previous `--url` for correct folder structure.
|
|
88
88
|
|
|
89
|
+
**Auto:**
|
|
90
|
+
- **`--auto`**:<br>
|
|
91
|
+
If set, csv, skip and cdxbackup/cdxinject are handled automatically. Keep the files and folders as they are. Otherwise they will not be recognized when restarting a download.
|
|
92
|
+
|
|
89
93
|
### Debug
|
|
90
94
|
|
|
91
95
|
- `--debug`: If set, full traceback will be printed in case of an error. The full exception will be written into `waybackup_error.log`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.1"
|
|
@@ -97,26 +97,28 @@ def print_list():
|
|
|
97
97
|
# create filelist
|
|
98
98
|
# timestamp format yyyyMMddhhmmss
|
|
99
99
|
def query_list(url: str, range: int, start: int, end: int, explicit: bool, mode: str, cdxbackup: str, cdxinject: str):
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
|
|
101
|
+
def inject(cdxinject):
|
|
102
|
+
if os.path.isfile(cdxinject):
|
|
102
103
|
vb.write("\nInjecting CDX data...")
|
|
103
104
|
cdxResult = open(cdxinject, "r")
|
|
104
105
|
cdxResult = cdxResult.read()
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
linecount = cdxResult.count("\n") - 1
|
|
107
|
+
vb.write(f"\n-----> {linecount} snapshots injected")
|
|
108
|
+
return cdxResult
|
|
109
|
+
else:
|
|
110
|
+
vb.write("\nNo CDX file found to inject - querying snapshots...")
|
|
111
|
+
return False
|
|
112
|
+
|
|
113
|
+
def query(url, range, start, end, explicit):
|
|
110
114
|
vb.write("\nQuerying snapshots...")
|
|
111
115
|
query_range = ""
|
|
112
|
-
|
|
113
116
|
if not range:
|
|
114
117
|
if start: query_range = query_range + f"&from={start}"
|
|
115
118
|
if end: query_range = query_range + f"&to={end}"
|
|
116
119
|
else:
|
|
117
120
|
query_range = "&from=" + str(datetime.now().year - range)
|
|
118
121
|
|
|
119
|
-
# parse user input url and create according cdx url
|
|
120
122
|
domain, subdir, filename = url_split(url)
|
|
121
123
|
if domain and not subdir and not filename:
|
|
122
124
|
cdx_url = f"*.{domain}/*" if not explicit else f"{domain}"
|
|
@@ -142,6 +144,13 @@ def query_list(url: str, range: int, start: int, end: int, explicit: bool, mode:
|
|
|
142
144
|
file.write(cdxResult)
|
|
143
145
|
vb.write("\n-----> CDX backup generated")
|
|
144
146
|
|
|
147
|
+
return cdxResult
|
|
148
|
+
|
|
149
|
+
cdxResult = None
|
|
150
|
+
if cdxinject:
|
|
151
|
+
cdxResult = inject(cdxinject)
|
|
152
|
+
if not cdxResult:
|
|
153
|
+
cdxResult = query(url, range, start, end, explicit)
|
|
145
154
|
cdxResult = json.loads(cdxResult)
|
|
146
155
|
sc.create_list(cdxResult, mode)
|
|
147
156
|
vb.write(f"\n-----> {sc.count(collection=True)} snapshots to utilize")
|
|
@@ -36,6 +36,9 @@ def parse():
|
|
|
36
36
|
exclusive_cdx.add_argument('--cdxbackup', type=str, nargs='?', const=True, metavar='path', help='Save the cdx query-result to a file for recurent use - defaults to output folder')
|
|
37
37
|
exclusive_cdx.add_argument('--cdxinject', type=str, nargs='?', const=True, metavar='path', help='Inject a cdx backup-file to download according to the given url')
|
|
38
38
|
|
|
39
|
+
auto = parser.add_argument_group('auto')
|
|
40
|
+
auto.add_argument('--auto', action='store_true', help='includes automatic csv, skip and cdxbackup/cdxinject to resume a stopped download')
|
|
41
|
+
|
|
39
42
|
args = parser.parse_args(args=None if sys.argv[1:] else ['--help']) # if no arguments are given, print help
|
|
40
43
|
command = ' '.join(sys.argv[1:])
|
|
41
44
|
|
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
|
|
3
3
|
import signal
|
|
4
4
|
|
|
5
|
+
import pywaybackup.helper as helper
|
|
5
6
|
import pywaybackup.archive as archive
|
|
6
7
|
|
|
7
8
|
from pywaybackup.arguments import parse
|
|
@@ -25,14 +26,20 @@ def main():
|
|
|
25
26
|
if args.current:
|
|
26
27
|
mode = "current"
|
|
27
28
|
|
|
28
|
-
if args.
|
|
29
|
+
if args.auto:
|
|
29
30
|
args.skip = args.output
|
|
30
|
-
if args.csv is True:
|
|
31
31
|
args.csv = args.output
|
|
32
|
-
if args.cdxbackup is True:
|
|
33
32
|
args.cdxbackup = args.output
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
args.cdxinject = os.path.join(args.output, f"waybackup_{helper.sanitize_filename(args.url)}.cdx")
|
|
34
|
+
else:
|
|
35
|
+
if args.skip is True:
|
|
36
|
+
args.skip = args.output
|
|
37
|
+
if args.csv is True:
|
|
38
|
+
args.csv = args.output
|
|
39
|
+
if args.cdxbackup is True:
|
|
40
|
+
args.cdxbackup = args.output
|
|
41
|
+
if args.cdxinject is True:
|
|
42
|
+
args.cdxinject = args.output
|
|
36
43
|
|
|
37
44
|
if args.save:
|
|
38
45
|
archive.save_page(args.url)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pywaybackup
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Download snapshots from the Wayback Machine
|
|
5
5
|
Home-page: https://github.com/bitdruid/python-wayback-machine-downloader
|
|
6
6
|
Author: bitdruid
|
|
@@ -102,6 +102,10 @@ Path defaults to output-dir. Saves the result of CDX query as a file. Useful for
|
|
|
102
102
|
- **`--cdxinject`** `<filepath>`:<br>
|
|
103
103
|
Injects a CDX query file to download snapshots. Ensure the query matches the previous `--url` for correct folder structure.
|
|
104
104
|
|
|
105
|
+
**Auto:**
|
|
106
|
+
- **`--auto`**:<br>
|
|
107
|
+
If set, csv, skip and cdxbackup/cdxinject are handled automatically. Keep the files and folders as they are. Otherwise they will not be recognized when restarting a download.
|
|
108
|
+
|
|
105
109
|
### Debug
|
|
106
110
|
|
|
107
111
|
- `--debug`: If set, full traceback will be printed in case of an error. The full exception will be written into `waybackup_error.log`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.6"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|