pywaybackup 0.6.2__tar.gz → 0.6.3__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.
@@ -0,0 +1,8 @@
1
+ .venv/
2
+ .test/
3
+ pywaybackup/__pycache__/
4
+ waybackup_snapshots/
5
+ dist/
6
+ pywaybackup.egg-info/
7
+ build/
8
+ ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pywaybackup
3
- Version: 0.6.2
3
+ Version: 0.6.3
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
@@ -46,7 +46,7 @@ This script allows you to download content from the Wayback Machine (archive.org
46
46
  ### Arguments
47
47
 
48
48
  - `-h`, `--help`: Show the help message and exit.
49
- - `-v`, `--version`: Show the script's version.
49
+ - `-a`, `--about`: Show information about the script and exit.
50
50
 
51
51
  #### Required Arguments
52
52
 
@@ -62,9 +62,15 @@ This script allows you to download content from the Wayback Machine (archive.org
62
62
 
63
63
  - `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
64
64
  - `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths.
65
- - `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
66
65
  - `-o OUTPUT`, `--output OUTPUT`: The folder where downloaded files will be saved.
67
66
 
67
+ - **Range Selection:**<br>
68
+ Specify the range in years or a specific timestamp either start, end or both. If you specify the `range` argument, the `start` and `end` arguments will be ignored. Format for timestamps: YYYYMMDDhhmmss. You can only give a year or increase specificity by going through the timestamp starting on the left.<br>
69
+ (year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
70
+ - `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
71
+ - `--start`: Timestamp to start searching.
72
+ - `--end`: Timestamp to end searching.
73
+
68
74
  #### Additional
69
75
 
70
76
  - `--verbosity [LEVEL]`: Set the verbosity: json (print json response), progress (show progress bar) or standard (default).
@@ -34,7 +34,7 @@ This script allows you to download content from the Wayback Machine (archive.org
34
34
  ### Arguments
35
35
 
36
36
  - `-h`, `--help`: Show the help message and exit.
37
- - `-v`, `--version`: Show the script's version.
37
+ - `-a`, `--about`: Show information about the script and exit.
38
38
 
39
39
  #### Required Arguments
40
40
 
@@ -50,9 +50,15 @@ This script allows you to download content from the Wayback Machine (archive.org
50
50
 
51
51
  - `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
52
52
  - `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths.
53
- - `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
54
53
  - `-o OUTPUT`, `--output OUTPUT`: The folder where downloaded files will be saved.
55
54
 
55
+ - **Range Selection:**<br>
56
+ Specify the range in years or a specific timestamp either start, end or both. If you specify the `range` argument, the `start` and `end` arguments will be ignored. Format for timestamps: YYYYMMDDhhmmss. You can only give a year or increase specificity by going through the timestamp starting on the left.<br>
57
+ (year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
58
+ - `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
59
+ - `--start`: Timestamp to start searching.
60
+ - `--end`: Timestamp to end searching.
61
+
56
62
  #### Additional
57
63
 
58
64
  - `--verbosity [LEVEL]`: Set the verbosity: json (print json response), progress (show progress bar) or standard (default).
@@ -0,0 +1,19 @@
1
+ #!bin/bash
2
+
3
+ # path of the script
4
+ SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5
+ TARGET_PATH="$SCRIPT_PATH/.."
6
+
7
+ # check if venv is activated
8
+ if [ -z "$VIRTUAL_ENV" ]; then
9
+ echo "Please activate your virtual environment"
10
+ exit 1
11
+ fi
12
+
13
+ # build
14
+ python $TARGET_PATH/setup.py sdist bdist_wheel --verbose
15
+ python -m twine upload dist/*
16
+ #pip install -e $TARGET_PATH
17
+
18
+ # clean up
19
+ rm -rf $TARGET_PATH/build $TARGET_PATH/dist # $TARGET_PATH/*.egg-info
@@ -0,0 +1,17 @@
1
+ #!bin/bash
2
+
3
+ # path of the script
4
+ SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5
+ TARGET_PATH="$SCRIPT_PATH/.."
6
+ echo "Preparing virtual environment in $TARGET_PATH"
7
+ # Create a virtual environment
8
+ if [ ! -d "..$SCRIPT_PATH/.venv" ]; then
9
+ python3 -m venv "$TARGET_PATH/.venv"
10
+ fi
11
+
12
+ # update pip
13
+ "$TARGET_PATH/.venv/bin/python" -m pip install --upgrade pip
14
+ "$TARGET_PATH/.venv/bin/python" -m pip install twine wheel
15
+
16
+ # install requirements
17
+ "$TARGET_PATH/.venv/bin/python" -m pip install -r "$TARGET_PATH/requirements.txt"
@@ -15,7 +15,7 @@ class SnapshotCollection:
15
15
 
16
16
  def create_full(self, cdxResult):
17
17
  self.CDX_JSON = cdxResult.json()[1:]
18
- self.CDX_LIST = [{"id": i, "timestamp": snapshot[0], "url": snapshot[1]} for i, snapshot in enumerate(self.CDX_JSON)]
18
+ self.CDX_LIST = [{"timestamp": snapshot[0], "url": snapshot[1]} for i, snapshot in enumerate(self.CDX_JSON)]
19
19
  self.CDX_LIST = sorted(self.CDX_LIST, key=lambda k: k['timestamp'], reverse=True)
20
20
 
21
21
  def create_current(self):
@@ -38,7 +38,7 @@ class SnapshotCollection:
38
38
  else: download_dir = os.path.join(output, domain, timestamp, subdir)
39
39
  download_file = os.path.join(download_dir, filename)
40
40
  cdx_entry = {
41
- "id": cdx_entry["id"],
41
+ "id": len(self.SNAPSHOT_COLLECTION),
42
42
  "url": download_url,
43
43
  "file": download_file,
44
44
  "timestamp": timestamp,
@@ -0,0 +1 @@
1
+ __version__ = "0.6.3"
@@ -83,14 +83,15 @@ def print_list(snapshots):
83
83
 
84
84
 
85
85
  # create filelist
86
- def query_list(snapshots: sc.SnapshotCollection, url: str, range: int, explicit: bool, mode: str):
86
+ # timestamp format yyyyMMddhhmmss
87
+ def query_list(snapshots: sc.SnapshotCollection, url: str, range: int, start: int, end: int, explicit: bool, mode: str):
87
88
  try:
88
89
  v.write("\nQuerying snapshots...")
89
- if range:
90
- range = datetime.now().year - range
91
- range = "&from=" + str(range)
92
- else:
93
- range = ""
90
+ range = ""
91
+ if not range:
92
+ if start: range = range + f"&from={start}"
93
+ if end: range = range + f"&to={end}"
94
+ else: range = "&from=" + str(datetime.now().year - range)
94
95
  cdx_url = f"*.{url}/*" if not explicit else f"{url}"
95
96
  cdxQuery = f"https://web.archive.org/cdx/search/xd?output=json&url={cdx_url}{range}&fl=timestamp,original&filter=!statuscode:200"
96
97
  cdxResult = requests.get(cdxQuery)
@@ -19,10 +19,12 @@ def main():
19
19
  optional = parser.add_argument_group('optional')
20
20
  optional.add_argument('-l', '--list', action='store_true', help='Only print snapshots (opt range in y)')
21
21
  optional.add_argument('-e', '--explicit', action='store_true', help='Search only for the explicit given url')
22
- optional.add_argument('-r', '--range', type=int, help='Range in years to search')
23
22
  optional.add_argument('-o', '--output', type=str, help='Output folder')
24
- optional.add_argument('-v', '--verbosity', type=str, default="standard", choices=["standard", "progress", "json"], help='Verbosity level')
23
+ optional.add_argument('-r', '--range', type=int, help='Range in years to search')
24
+ optional.add_argument('--start', type=int, help='Start timestamp format: YYYYMMDDhhmmss')
25
+ optional.add_argument('--end', type=int, help='End timestamp format: YYYYMMDDhhmmss')
25
26
  special = parser.add_argument_group('special')
27
+ special.add_argument('--verbosity', type=str, default="standard", choices=["standard", "progress", "json"], help='Verbosity level')
26
28
  special.add_argument('--retry', type=int, default=0, metavar="X-TIMES", help='Retry failed downloads (opt tries as int, else infinite)')
27
29
  special.add_argument('--worker', type=int, default=1, metavar="AMOUNT", help='Number of worker (simultaneous downloads)')
28
30
 
@@ -40,7 +42,7 @@ def main():
40
42
  else:
41
43
  if args.output is None:
42
44
  args.output = os.path.join(os.getcwd(), "waybackup_snapshots")
43
- archive.query_list(snapshots, args.url, args.range, args.explicit, mode)
45
+ archive.query_list(snapshots, args.url, args.range, args.start, args.end, args.explicit, mode)
44
46
  if args.list:
45
47
  archive.print_list(snapshots)
46
48
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pywaybackup
3
- Version: 0.6.2
3
+ Version: 0.6.3
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
@@ -46,7 +46,7 @@ This script allows you to download content from the Wayback Machine (archive.org
46
46
  ### Arguments
47
47
 
48
48
  - `-h`, `--help`: Show the help message and exit.
49
- - `-v`, `--version`: Show the script's version.
49
+ - `-a`, `--about`: Show information about the script and exit.
50
50
 
51
51
  #### Required Arguments
52
52
 
@@ -62,9 +62,15 @@ This script allows you to download content from the Wayback Machine (archive.org
62
62
 
63
63
  - `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
64
64
  - `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths.
65
- - `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
66
65
  - `-o OUTPUT`, `--output OUTPUT`: The folder where downloaded files will be saved.
67
66
 
67
+ - **Range Selection:**<br>
68
+ Specify the range in years or a specific timestamp either start, end or both. If you specify the `range` argument, the `start` and `end` arguments will be ignored. Format for timestamps: YYYYMMDDhhmmss. You can only give a year or increase specificity by going through the timestamp starting on the left.<br>
69
+ (year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
70
+ - `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
71
+ - `--start`: Timestamp to start searching.
72
+ - `--end`: Timestamp to end searching.
73
+
68
74
  #### Additional
69
75
 
70
76
  - `--verbosity [LEVEL]`: Set the verbosity: json (print json response), progress (show progress bar) or standard (default).
@@ -1,6 +1,10 @@
1
+ .gitignore
1
2
  LICENSE
2
3
  README.md
4
+ requirements.txt
3
5
  setup.py
6
+ dev/pip_build.sh
7
+ dev/venv_create.sh
4
8
  pywaybackup/SnapshotCollection.py
5
9
  pywaybackup/Verbosity.py
6
10
  pywaybackup/__init__.py
@@ -0,0 +1,2 @@
1
+ requests==2.31.0
2
+ tqdm==4.66.2
@@ -1 +0,0 @@
1
- __version__ = "0.6.2"
File without changes
File without changes
File without changes