pywaybackup 0.8.1__tar.gz → 1.0.2__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.0.2/PKG-INFO +187 -0
- pywaybackup-1.0.2/README.md +173 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup/SnapshotCollection.py +12 -7
- pywaybackup-1.0.2/pywaybackup/__version__.py +1 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup/archive.py +25 -8
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup/arguments.py +11 -10
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup/main.py +2 -2
- pywaybackup-1.0.2/pywaybackup.egg-info/PKG-INFO +187 -0
- pywaybackup-0.8.1/PKG-INFO +0 -104
- pywaybackup-0.8.1/README.md +0 -92
- pywaybackup-0.8.1/pywaybackup/__version__.py +0 -1
- pywaybackup-0.8.1/pywaybackup.egg-info/PKG-INFO +0 -104
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/LICENSE +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup/Verbosity.py +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup/__init__.py +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup.egg-info/SOURCES.txt +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup.egg-info/dependency_links.txt +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup.egg-info/entry_points.txt +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup.egg-info/requires.txt +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/pywaybackup.egg-info/top_level.txt +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/setup.cfg +0 -0
- {pywaybackup-0.8.1 → pywaybackup-1.0.2}/setup.py +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pywaybackup
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Download snapshots from the Wayback Machine
|
|
5
|
+
Home-page: https://github.com/bitdruid/python-wayback-machine-downloader
|
|
6
|
+
Author: bitdruid
|
|
7
|
+
Author-email: bitdruid@outlook.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: wayback machine internet archive
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: requests==2.31.0
|
|
13
|
+
Requires-Dist: tqdm==4.66.2
|
|
14
|
+
|
|
15
|
+
# archive wayback downloader
|
|
16
|
+
|
|
17
|
+
[](https://pypi.org/project/pywaybackup/)
|
|
18
|
+
[](https://pypi.org/project/pywaybackup/)
|
|
19
|
+

|
|
20
|
+
[](https://opensource.org/licenses/MIT)
|
|
21
|
+
|
|
22
|
+
Downloading archived web pages from the [Wayback Machine](https://archive.org/web/).
|
|
23
|
+
|
|
24
|
+
Internet-archive is a nice source for several OSINT-information. This script is a work in progress to query and fetch archived web pages.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### Pip
|
|
29
|
+
|
|
30
|
+
1. Install the package <br>
|
|
31
|
+
```pip install pywaybackup```
|
|
32
|
+
2. Run the script <br>
|
|
33
|
+
```waybackup -h```
|
|
34
|
+
|
|
35
|
+
### Manual
|
|
36
|
+
|
|
37
|
+
1. Clone the repository <br>
|
|
38
|
+
```git clone https://github.com/bitdruid/python-wayback-machine-downloader.git```
|
|
39
|
+
2. Install <br>
|
|
40
|
+
```pip install .```
|
|
41
|
+
- in a virtual env or use `--break-system-package`
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
This script allows you to download content from the Wayback Machine (archive.org). You can use it to download either the latest version or all versions of web page snapshots within a specified range.
|
|
46
|
+
|
|
47
|
+
### Arguments
|
|
48
|
+
|
|
49
|
+
- `-h`, `--help`: Show the help message and exit.
|
|
50
|
+
- `-a`, `--about`: Show information about the script and exit.
|
|
51
|
+
|
|
52
|
+
#### Required Arguments
|
|
53
|
+
|
|
54
|
+
- `-u`, `--url`: The URL of the web page to download. This argument is required.
|
|
55
|
+
|
|
56
|
+
#### Mode Selection (Choose One)
|
|
57
|
+
|
|
58
|
+
- `-c`, `--current`: Download the latest version of each file snapshot. You will get a rebuild of the current website with all available files (but not any original state because new and old versions are mixed).
|
|
59
|
+
- `-f`, `--full`: Download snapshots of all timestamps. You will get a folder per timestamp with the files available at that time.
|
|
60
|
+
- `-s`, `--save`: Save a page to the Wayback Machine. (beta)
|
|
61
|
+
|
|
62
|
+
#### Optional Arguments
|
|
63
|
+
|
|
64
|
+
- `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
|
|
65
|
+
- `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths. Use e.g. to get root-only snapshots.
|
|
66
|
+
- `-o`, `--output`: The folder where downloaded files will be saved.
|
|
67
|
+
|
|
68
|
+
- **Range Selection:**<br>
|
|
69
|
+
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>
|
|
70
|
+
(year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
|
|
71
|
+
- `-r`, `--range`: Specify the range in years for which to search and download snapshots.
|
|
72
|
+
- `--start`: Timestamp to start searching.
|
|
73
|
+
- `--end`: Timestamp to end searching.
|
|
74
|
+
|
|
75
|
+
#### Additional
|
|
76
|
+
|
|
77
|
+
- `--csv`: Save a csv file with the list of snapshots inside the output folder or a specified folder. If you set `--list` the csv will contain the cdx list of snapshots. If you set either `--current` or `--full` the csv will contain the downloaded files.
|
|
78
|
+
- `--no-redirect`: Do not follow redirects of snapshots. Archive.org sometimes redirects to a different snapshot for several reasons. Downloading redirects may lead to timestamp-folders which contain some files with a different timestamp. This does not matter if you only want to download the latest version (`-c`).
|
|
79
|
+
- `--verbosity`: Set the verbosity: json (print json response), progress (show progress bar).
|
|
80
|
+
- `--retry`: Retry failed downloads. You can specify the number of retry attempts as an integer.
|
|
81
|
+
- `--workers`: The number of workers to use for downloading (simultaneous downloads). Default is 1. A safe spot is about 10 workers. Beware: Using too many workers will lead into refused connections from the Wayback Machine. Duration about 1.5 minutes.
|
|
82
|
+
|
|
83
|
+
### Examples
|
|
84
|
+
|
|
85
|
+
Download latest snapshot of all files:<br>
|
|
86
|
+
`waybackup -u http://example.com -c`
|
|
87
|
+
|
|
88
|
+
Download latest snapshot of a specific file:<br>
|
|
89
|
+
`waybackup -u http://example.com/subdir/file.html -c`
|
|
90
|
+
|
|
91
|
+
Download all snapshots sorted per timestamp with a specified range and do not follow redirects:<br>
|
|
92
|
+
`waybackup -u http://example.com -f -r 5 --no-redirect`
|
|
93
|
+
|
|
94
|
+
Download all snapshots sorted per timestamp with a specified range and save to a specified folder with 3 workers:<br>
|
|
95
|
+
`waybackup -u http://example.com -f -r 5 -o /home/user/Downloads/snapshots --workers 3`
|
|
96
|
+
|
|
97
|
+
Download all snapshots from 2020 to 12th of December 2022 with 4 workers, save a csv and show a progress bar:
|
|
98
|
+
`waybackup -u http://example.com -f --start 2020 --end 20221212 --workers 4 --csv --verbosity progress`
|
|
99
|
+
|
|
100
|
+
Download all snapshots and output a json response:<br>
|
|
101
|
+
`waybackup -u http://example.com -f --verbosity json`
|
|
102
|
+
|
|
103
|
+
List available snapshots per timestamp without downloading and save a csv file to home folder:<br>
|
|
104
|
+
`waybackup -u http://example.com -f -l --csv /home/user/Downloads`
|
|
105
|
+
|
|
106
|
+
## Output path structure
|
|
107
|
+
|
|
108
|
+
The output path is currently structured as follows by an example for the query:<br>
|
|
109
|
+
`http://example.com/subdir1/subdir2/assets/`:
|
|
110
|
+
<br><br>
|
|
111
|
+
For the current version (`-c`):
|
|
112
|
+
- The requested path will only include all files/folders starting from your query-path.
|
|
113
|
+
```
|
|
114
|
+
your/path/waybackup_snapshots/
|
|
115
|
+
└── the_root_of_your_query/ (example.com/)
|
|
116
|
+
└── subdir1/
|
|
117
|
+
└── subdir2/
|
|
118
|
+
└── assets/
|
|
119
|
+
├── image.jpg
|
|
120
|
+
├── style.css
|
|
121
|
+
...
|
|
122
|
+
```
|
|
123
|
+
For all versions (`-f`):
|
|
124
|
+
- Will currently create a folder named as the root of your query. Inside this folder, you will find all timestamps and per timestamp the path you requested.
|
|
125
|
+
```
|
|
126
|
+
your/path/waybackup_snapshots/
|
|
127
|
+
└── the_root_of_your_query/ (example.com/)
|
|
128
|
+
├── yyyymmddhhmmss/
|
|
129
|
+
│ ├── subidr1/
|
|
130
|
+
│ │ └── subdir2/
|
|
131
|
+
│ │ └── assets/
|
|
132
|
+
│ │ ├── image.jpg
|
|
133
|
+
│ │ └── style.css
|
|
134
|
+
├── yyyymmddhhmmss/
|
|
135
|
+
│ ├── subdir1/
|
|
136
|
+
│ │ └── subdir2/
|
|
137
|
+
│ │ └── assets/
|
|
138
|
+
│ │ ├── image.jpg
|
|
139
|
+
│ │ └── style.css
|
|
140
|
+
...
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Json Response
|
|
145
|
+
|
|
146
|
+
For download queries:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
[
|
|
150
|
+
{
|
|
151
|
+
"file": "/your/path/waybackup_snapshots/example.com/yyyymmddhhmmss/index.html",
|
|
152
|
+
"id": 1,
|
|
153
|
+
"redirect_timestamp": "yyyymmddhhmmss",
|
|
154
|
+
"redirect_url": "http://web.archive.org/web/yyyymmddhhmmssid_/http://example.com/",
|
|
155
|
+
"response": 200,
|
|
156
|
+
"timestamp": "yyyymmddhhmmss",
|
|
157
|
+
"url_archive": "http://web.archive.org/web/yyyymmddhhmmssid_/http://example.com/",
|
|
158
|
+
"url_origin": "http://example.com/"
|
|
159
|
+
},
|
|
160
|
+
...
|
|
161
|
+
]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
For list queries:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
[
|
|
168
|
+
{
|
|
169
|
+
"digest": "DIGESTOFSNAPSHOT",
|
|
170
|
+
"id": 1,
|
|
171
|
+
"mimetype": "text/html",
|
|
172
|
+
"status": "200",
|
|
173
|
+
"timestamp": "yyyymmddhhmmss",
|
|
174
|
+
"url": "http://example.com/"
|
|
175
|
+
},
|
|
176
|
+
...
|
|
177
|
+
]
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## CSV Output
|
|
181
|
+
|
|
182
|
+
The csv contains the json response in a table format.
|
|
183
|
+
|
|
184
|
+
## Contributing
|
|
185
|
+
|
|
186
|
+
I'm always happy for some feature requests to improve the usability of this script.
|
|
187
|
+
Feel free to give suggestions and report issues. Project is still far from being perfect.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# archive wayback downloader
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/pywaybackup/)
|
|
4
|
+
[](https://pypi.org/project/pywaybackup/)
|
|
5
|
+

|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
Downloading archived web pages from the [Wayback Machine](https://archive.org/web/).
|
|
9
|
+
|
|
10
|
+
Internet-archive is a nice source for several OSINT-information. This script is a work in progress to query and fetch archived web pages.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### Pip
|
|
15
|
+
|
|
16
|
+
1. Install the package <br>
|
|
17
|
+
```pip install pywaybackup```
|
|
18
|
+
2. Run the script <br>
|
|
19
|
+
```waybackup -h```
|
|
20
|
+
|
|
21
|
+
### Manual
|
|
22
|
+
|
|
23
|
+
1. Clone the repository <br>
|
|
24
|
+
```git clone https://github.com/bitdruid/python-wayback-machine-downloader.git```
|
|
25
|
+
2. Install <br>
|
|
26
|
+
```pip install .```
|
|
27
|
+
- in a virtual env or use `--break-system-package`
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
This script allows you to download content from the Wayback Machine (archive.org). You can use it to download either the latest version or all versions of web page snapshots within a specified range.
|
|
32
|
+
|
|
33
|
+
### Arguments
|
|
34
|
+
|
|
35
|
+
- `-h`, `--help`: Show the help message and exit.
|
|
36
|
+
- `-a`, `--about`: Show information about the script and exit.
|
|
37
|
+
|
|
38
|
+
#### Required Arguments
|
|
39
|
+
|
|
40
|
+
- `-u`, `--url`: The URL of the web page to download. This argument is required.
|
|
41
|
+
|
|
42
|
+
#### Mode Selection (Choose One)
|
|
43
|
+
|
|
44
|
+
- `-c`, `--current`: Download the latest version of each file snapshot. You will get a rebuild of the current website with all available files (but not any original state because new and old versions are mixed).
|
|
45
|
+
- `-f`, `--full`: Download snapshots of all timestamps. You will get a folder per timestamp with the files available at that time.
|
|
46
|
+
- `-s`, `--save`: Save a page to the Wayback Machine. (beta)
|
|
47
|
+
|
|
48
|
+
#### Optional Arguments
|
|
49
|
+
|
|
50
|
+
- `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
|
|
51
|
+
- `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths. Use e.g. to get root-only snapshots.
|
|
52
|
+
- `-o`, `--output`: The folder where downloaded files will be saved.
|
|
53
|
+
|
|
54
|
+
- **Range Selection:**<br>
|
|
55
|
+
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>
|
|
56
|
+
(year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
|
|
57
|
+
- `-r`, `--range`: Specify the range in years for which to search and download snapshots.
|
|
58
|
+
- `--start`: Timestamp to start searching.
|
|
59
|
+
- `--end`: Timestamp to end searching.
|
|
60
|
+
|
|
61
|
+
#### Additional
|
|
62
|
+
|
|
63
|
+
- `--csv`: Save a csv file with the list of snapshots inside the output folder or a specified folder. If you set `--list` the csv will contain the cdx list of snapshots. If you set either `--current` or `--full` the csv will contain the downloaded files.
|
|
64
|
+
- `--no-redirect`: Do not follow redirects of snapshots. Archive.org sometimes redirects to a different snapshot for several reasons. Downloading redirects may lead to timestamp-folders which contain some files with a different timestamp. This does not matter if you only want to download the latest version (`-c`).
|
|
65
|
+
- `--verbosity`: Set the verbosity: json (print json response), progress (show progress bar).
|
|
66
|
+
- `--retry`: Retry failed downloads. You can specify the number of retry attempts as an integer.
|
|
67
|
+
- `--workers`: The number of workers to use for downloading (simultaneous downloads). Default is 1. A safe spot is about 10 workers. Beware: Using too many workers will lead into refused connections from the Wayback Machine. Duration about 1.5 minutes.
|
|
68
|
+
|
|
69
|
+
### Examples
|
|
70
|
+
|
|
71
|
+
Download latest snapshot of all files:<br>
|
|
72
|
+
`waybackup -u http://example.com -c`
|
|
73
|
+
|
|
74
|
+
Download latest snapshot of a specific file:<br>
|
|
75
|
+
`waybackup -u http://example.com/subdir/file.html -c`
|
|
76
|
+
|
|
77
|
+
Download all snapshots sorted per timestamp with a specified range and do not follow redirects:<br>
|
|
78
|
+
`waybackup -u http://example.com -f -r 5 --no-redirect`
|
|
79
|
+
|
|
80
|
+
Download all snapshots sorted per timestamp with a specified range and save to a specified folder with 3 workers:<br>
|
|
81
|
+
`waybackup -u http://example.com -f -r 5 -o /home/user/Downloads/snapshots --workers 3`
|
|
82
|
+
|
|
83
|
+
Download all snapshots from 2020 to 12th of December 2022 with 4 workers, save a csv and show a progress bar:
|
|
84
|
+
`waybackup -u http://example.com -f --start 2020 --end 20221212 --workers 4 --csv --verbosity progress`
|
|
85
|
+
|
|
86
|
+
Download all snapshots and output a json response:<br>
|
|
87
|
+
`waybackup -u http://example.com -f --verbosity json`
|
|
88
|
+
|
|
89
|
+
List available snapshots per timestamp without downloading and save a csv file to home folder:<br>
|
|
90
|
+
`waybackup -u http://example.com -f -l --csv /home/user/Downloads`
|
|
91
|
+
|
|
92
|
+
## Output path structure
|
|
93
|
+
|
|
94
|
+
The output path is currently structured as follows by an example for the query:<br>
|
|
95
|
+
`http://example.com/subdir1/subdir2/assets/`:
|
|
96
|
+
<br><br>
|
|
97
|
+
For the current version (`-c`):
|
|
98
|
+
- The requested path will only include all files/folders starting from your query-path.
|
|
99
|
+
```
|
|
100
|
+
your/path/waybackup_snapshots/
|
|
101
|
+
└── the_root_of_your_query/ (example.com/)
|
|
102
|
+
└── subdir1/
|
|
103
|
+
└── subdir2/
|
|
104
|
+
└── assets/
|
|
105
|
+
├── image.jpg
|
|
106
|
+
├── style.css
|
|
107
|
+
...
|
|
108
|
+
```
|
|
109
|
+
For all versions (`-f`):
|
|
110
|
+
- Will currently create a folder named as the root of your query. Inside this folder, you will find all timestamps and per timestamp the path you requested.
|
|
111
|
+
```
|
|
112
|
+
your/path/waybackup_snapshots/
|
|
113
|
+
└── the_root_of_your_query/ (example.com/)
|
|
114
|
+
├── yyyymmddhhmmss/
|
|
115
|
+
│ ├── subidr1/
|
|
116
|
+
│ │ └── subdir2/
|
|
117
|
+
│ │ └── assets/
|
|
118
|
+
│ │ ├── image.jpg
|
|
119
|
+
│ │ └── style.css
|
|
120
|
+
├── yyyymmddhhmmss/
|
|
121
|
+
│ ├── subdir1/
|
|
122
|
+
│ │ └── subdir2/
|
|
123
|
+
│ │ └── assets/
|
|
124
|
+
│ │ ├── image.jpg
|
|
125
|
+
│ │ └── style.css
|
|
126
|
+
...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### Json Response
|
|
131
|
+
|
|
132
|
+
For download queries:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
[
|
|
136
|
+
{
|
|
137
|
+
"file": "/your/path/waybackup_snapshots/example.com/yyyymmddhhmmss/index.html",
|
|
138
|
+
"id": 1,
|
|
139
|
+
"redirect_timestamp": "yyyymmddhhmmss",
|
|
140
|
+
"redirect_url": "http://web.archive.org/web/yyyymmddhhmmssid_/http://example.com/",
|
|
141
|
+
"response": 200,
|
|
142
|
+
"timestamp": "yyyymmddhhmmss",
|
|
143
|
+
"url_archive": "http://web.archive.org/web/yyyymmddhhmmssid_/http://example.com/",
|
|
144
|
+
"url_origin": "http://example.com/"
|
|
145
|
+
},
|
|
146
|
+
...
|
|
147
|
+
]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For list queries:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
[
|
|
154
|
+
{
|
|
155
|
+
"digest": "DIGESTOFSNAPSHOT",
|
|
156
|
+
"id": 1,
|
|
157
|
+
"mimetype": "text/html",
|
|
158
|
+
"status": "200",
|
|
159
|
+
"timestamp": "yyyymmddhhmmss",
|
|
160
|
+
"url": "http://example.com/"
|
|
161
|
+
},
|
|
162
|
+
...
|
|
163
|
+
]
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## CSV Output
|
|
167
|
+
|
|
168
|
+
The csv contains the json response in a table format.
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
I'm always happy for some feature requests to improve the usability of this script.
|
|
173
|
+
Feel free to give suggestions and report issues. Project is still far from being perfect.
|
|
@@ -36,11 +36,11 @@ class SnapshotCollection:
|
|
|
36
36
|
@classmethod
|
|
37
37
|
def create_collection(cls):
|
|
38
38
|
new_collection = []
|
|
39
|
-
for cdx_entry in cls.SNAPSHOT_COLLECTION:
|
|
39
|
+
for idx, cdx_entry in enumerate(cls.SNAPSHOT_COLLECTION):
|
|
40
40
|
timestamp, url = cdx_entry["timestamp"], cdx_entry["url"]
|
|
41
41
|
url_archive = f"http://web.archive.org/web/{timestamp}{cls._url_get_filetype(url)}/{url}"
|
|
42
42
|
collection_entry = {
|
|
43
|
-
"id":
|
|
43
|
+
"id": idx,
|
|
44
44
|
"timestamp": timestamp,
|
|
45
45
|
"url_archive": url_archive,
|
|
46
46
|
"url_origin": url,
|
|
@@ -65,7 +65,7 @@ class SnapshotCollection:
|
|
|
65
65
|
- download_file: The output path for the snapshot entry (str) with filename.
|
|
66
66
|
"""
|
|
67
67
|
timestamp, url = collection_entry["timestamp"], collection_entry["url_origin"]
|
|
68
|
-
domain, subdir, filename = cls.
|
|
68
|
+
domain, subdir, filename = cls.url_split(url, index=True)
|
|
69
69
|
if cls.MODE_CURRENT:
|
|
70
70
|
download_dir = os.path.join(output, domain, subdir)
|
|
71
71
|
else:
|
|
@@ -109,12 +109,17 @@ class SnapshotCollection:
|
|
|
109
109
|
return urltype
|
|
110
110
|
|
|
111
111
|
@classmethod
|
|
112
|
-
def
|
|
112
|
+
def url_split(cls, url, index=False):
|
|
113
113
|
"""
|
|
114
114
|
Split a URL into domain, subdir and filename.
|
|
115
115
|
"""
|
|
116
|
+
if not urlparse(url).scheme:
|
|
117
|
+
url = "http://" + url
|
|
116
118
|
parsed_url = urlparse(url)
|
|
117
|
-
domain = parsed_url.netloc
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
domain = parsed_url.netloc.split("@")[-1].split(":")[0] # split mailto: and port
|
|
120
|
+
filename = parsed_url.path.split("/")[-1]
|
|
121
|
+
if index is True and filename == "":
|
|
122
|
+
filename = "index.html"
|
|
123
|
+
subdir = parsed_url.path.strip("/").replace(filename, "").strip("/")
|
|
124
|
+
filename = filename.replace("%20", " ") # replace url encoded spaces
|
|
120
125
|
return domain, subdir, filename
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.2"
|
|
@@ -89,12 +89,25 @@ def query_list(url: str, range: int, start: int, end: int, explicit: bool, mode:
|
|
|
89
89
|
try:
|
|
90
90
|
v.write("\nQuerying snapshots...")
|
|
91
91
|
query_range = ""
|
|
92
|
+
|
|
92
93
|
if not range:
|
|
93
94
|
if start: query_range = query_range + f"&from={start}"
|
|
94
95
|
if end: query_range = query_range + f"&to={end}"
|
|
95
96
|
else:
|
|
96
97
|
query_range = "&from=" + str(datetime.now().year - range)
|
|
97
|
-
|
|
98
|
+
|
|
99
|
+
# parse user input url and create according cdx url
|
|
100
|
+
domain, subdir, filename = sc.url_split(url)
|
|
101
|
+
if domain and not subdir and not filename:
|
|
102
|
+
cdx_url = f"*.{domain}/*" if not explicit else f"{domain}"
|
|
103
|
+
if domain and subdir and not filename:
|
|
104
|
+
cdx_url = f"{domain}/{subdir}/*"
|
|
105
|
+
if domain and subdir and filename:
|
|
106
|
+
cdx_url = f"{domain}/{subdir}/{filename}/*"
|
|
107
|
+
if domain and not subdir and filename:
|
|
108
|
+
cdx_url = f"{domain}/{filename}/*"
|
|
109
|
+
|
|
110
|
+
print(f"---> {cdx_url}")
|
|
98
111
|
cdxQuery = f"https://web.archive.org/cdx/search/xd?output=json&url={cdx_url}{query_range}&fl=timestamp,digest,mimetype,statuscode,original&filter!=statuscode:200"
|
|
99
112
|
cdxResult = requests.get(cdxQuery)
|
|
100
113
|
sc.create_list(cdxResult, mode)
|
|
@@ -107,7 +120,7 @@ def query_list(url: str, range: int, start: int, end: int, explicit: bool, mode:
|
|
|
107
120
|
|
|
108
121
|
|
|
109
122
|
# example download: http://web.archive.org/web/20190815104545id_/https://www.google.com/
|
|
110
|
-
def download_list(output, retry, no_redirect,
|
|
123
|
+
def download_list(output, retry, no_redirect, workers):
|
|
111
124
|
"""
|
|
112
125
|
Download a list of urls in format: [{"timestamp": "20190815104545", "url": "https://www.google.com/"}]
|
|
113
126
|
"""
|
|
@@ -115,18 +128,19 @@ def download_list(output, retry, no_redirect, worker):
|
|
|
115
128
|
v.write("\nNothing to download");
|
|
116
129
|
return
|
|
117
130
|
v.write("\nDownloading snapshots...", progress=0)
|
|
118
|
-
if
|
|
119
|
-
v.write(f"\n-----> Simultaneous downloads: {
|
|
120
|
-
batch_size = sc.count_list() //
|
|
131
|
+
if workers > 1:
|
|
132
|
+
v.write(f"\n-----> Simultaneous downloads: {workers}")
|
|
133
|
+
batch_size = sc.count_list() // workers + 1
|
|
121
134
|
else:
|
|
122
135
|
batch_size = sc.count_list()
|
|
123
136
|
sc.create_collection()
|
|
137
|
+
v.write("\n-----> Snapshots prepared")
|
|
124
138
|
batch_list = [sc.SNAPSHOT_COLLECTION[i:i + batch_size] for i in range(0, len(sc.SNAPSHOT_COLLECTION), batch_size)]
|
|
125
139
|
threads = []
|
|
126
140
|
worker = 0
|
|
127
141
|
for batch in batch_list:
|
|
128
142
|
worker += 1
|
|
129
|
-
thread = threading.Thread(target=download_loop, args=(batch, output,
|
|
143
|
+
thread = threading.Thread(target=download_loop, args=(batch, output, workers, retry, no_redirect))
|
|
130
144
|
threads.append(thread)
|
|
131
145
|
thread.start()
|
|
132
146
|
for thread in threads:
|
|
@@ -256,15 +270,18 @@ def parse_response_code(response_code: int):
|
|
|
256
270
|
return RESPONSE_CODE_DICT[response_code]
|
|
257
271
|
return "Unknown response code"
|
|
258
272
|
|
|
259
|
-
def save_csv(csv_path: str):
|
|
273
|
+
def save_csv(csv_path: str, url: str):
|
|
260
274
|
"""
|
|
261
275
|
Write a CSV file with the list of snapshots.
|
|
262
276
|
"""
|
|
263
277
|
import csv
|
|
278
|
+
disallowed = ['<', '>', ':', '"', '/', '\\', '|', '?', '*']
|
|
279
|
+
for char in disallowed:
|
|
280
|
+
url = url.replace(char, '.')
|
|
264
281
|
if sc.count_list() > 0:
|
|
265
282
|
v.write("\nSaving CSV file...")
|
|
266
283
|
os.makedirs(os.path.abspath(csv_path), exist_ok=True)
|
|
267
|
-
with open(os.path.join(csv_path, "
|
|
284
|
+
with open(os.path.join(csv_path, f"waybackup_{url}.csv"), mode='w') as file:
|
|
268
285
|
row = csv.DictWriter(file, sc.SNAPSHOT_COLLECTION[0].keys())
|
|
269
286
|
row.writeheader()
|
|
270
287
|
for snapshot in sc.SNAPSHOT_COLLECTION:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
import argparse
|
|
2
3
|
from pywaybackup.__version__ import __version__
|
|
3
4
|
|
|
@@ -7,7 +8,7 @@ def parse():
|
|
|
7
8
|
parser.add_argument('-a', '--about', action='version', version='%(prog)s ' + __version__ + ' by @bitdruid -> https://github.com/bitdruid')
|
|
8
9
|
|
|
9
10
|
required = parser.add_argument_group('required')
|
|
10
|
-
required.add_argument('-u', '--url', type=str, help='URL to use')
|
|
11
|
+
required.add_argument('-u', '--url', type=str, metavar="", help='URL to use')
|
|
11
12
|
exclusive_required = required.add_mutually_exclusive_group(required=True)
|
|
12
13
|
exclusive_required.add_argument('-c', '--current', action='store_true', help='Download the latest version of each file snapshot (opt range in y)')
|
|
13
14
|
exclusive_required.add_argument('-f', '--full', action='store_true', help='Download snapshots of all timestamps (opt range in y)')
|
|
@@ -16,18 +17,18 @@ def parse():
|
|
|
16
17
|
optional = parser.add_argument_group('optional')
|
|
17
18
|
optional.add_argument('-l', '--list', action='store_true', help='Only print snapshots (opt range in y)')
|
|
18
19
|
optional.add_argument('-e', '--explicit', action='store_true', help='Search only for the explicit given url')
|
|
19
|
-
optional.add_argument('-o', '--output', type=str, help='Output folder defaults to current directory')
|
|
20
|
-
optional.add_argument('-r', '--range', type=int, help='Range in years to search')
|
|
21
|
-
optional.add_argument('--start', type=int, help='Start timestamp format: YYYYMMDDhhmmss')
|
|
22
|
-
optional.add_argument('--end', type=int, help='End timestamp format: YYYYMMDDhhmmss')
|
|
20
|
+
optional.add_argument('-o', '--output', type=str, metavar="", help='Output folder defaults to current directory')
|
|
21
|
+
optional.add_argument('-r', '--range', type=int, metavar="", help='Range in years to search')
|
|
22
|
+
optional.add_argument('--start', type=int, metavar="", help='Start timestamp format: YYYYMMDDhhmmss')
|
|
23
|
+
optional.add_argument('--end', type=int, metavar="", help='End timestamp format: YYYYMMDDhhmmss')
|
|
23
24
|
|
|
24
25
|
special = parser.add_argument_group('special')
|
|
25
|
-
special.add_argument('--csv', type=str, nargs='?', const=True, help='Save a csv file on a given path or defaults to the output folder')
|
|
26
|
+
special.add_argument('--csv', type=str, nargs='?', const=True, metavar='', help='Save a csv file on a given path or defaults to the output folder')
|
|
26
27
|
special.add_argument('--no-redirect', action='store_true', help='Do not follow redirects by archive.org')
|
|
27
|
-
special.add_argument('--verbosity', type=str, default="standard",
|
|
28
|
-
special.add_argument('--retry', type=int, default=0, metavar="
|
|
29
|
-
special.add_argument('--
|
|
28
|
+
special.add_argument('--verbosity', type=str, default="standard", metavar="", help='["progress", "json"] Verbosity level')
|
|
29
|
+
special.add_argument('--retry', type=int, default=0, metavar="", help='Retry failed downloads (opt tries as int, else infinite)')
|
|
30
|
+
special.add_argument('--workers', type=int, default=1, metavar="", help='Number of workers (simultaneous downloads)')
|
|
30
31
|
|
|
31
|
-
args = parser.parse_args()
|
|
32
|
+
args = parser.parse_args(args=None if sys.argv[1:] else ['--help']) # if no arguments are given, print help
|
|
32
33
|
|
|
33
34
|
return args
|
|
@@ -25,9 +25,9 @@ def main():
|
|
|
25
25
|
if args.list:
|
|
26
26
|
archive.print_list()
|
|
27
27
|
else:
|
|
28
|
-
archive.download_list(args.output, args.retry, args.no_redirect, args.
|
|
28
|
+
archive.download_list(args.output, args.retry, args.no_redirect, args.workers)
|
|
29
29
|
if args.csv:
|
|
30
|
-
archive.save_csv(args.csv)
|
|
30
|
+
archive.save_csv(args.csv, args.url)
|
|
31
31
|
v.close()
|
|
32
32
|
|
|
33
33
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pywaybackup
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Download snapshots from the Wayback Machine
|
|
5
|
+
Home-page: https://github.com/bitdruid/python-wayback-machine-downloader
|
|
6
|
+
Author: bitdruid
|
|
7
|
+
Author-email: bitdruid@outlook.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: wayback machine internet archive
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: requests==2.31.0
|
|
13
|
+
Requires-Dist: tqdm==4.66.2
|
|
14
|
+
|
|
15
|
+
# archive wayback downloader
|
|
16
|
+
|
|
17
|
+
[](https://pypi.org/project/pywaybackup/)
|
|
18
|
+
[](https://pypi.org/project/pywaybackup/)
|
|
19
|
+

|
|
20
|
+
[](https://opensource.org/licenses/MIT)
|
|
21
|
+
|
|
22
|
+
Downloading archived web pages from the [Wayback Machine](https://archive.org/web/).
|
|
23
|
+
|
|
24
|
+
Internet-archive is a nice source for several OSINT-information. This script is a work in progress to query and fetch archived web pages.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### Pip
|
|
29
|
+
|
|
30
|
+
1. Install the package <br>
|
|
31
|
+
```pip install pywaybackup```
|
|
32
|
+
2. Run the script <br>
|
|
33
|
+
```waybackup -h```
|
|
34
|
+
|
|
35
|
+
### Manual
|
|
36
|
+
|
|
37
|
+
1. Clone the repository <br>
|
|
38
|
+
```git clone https://github.com/bitdruid/python-wayback-machine-downloader.git```
|
|
39
|
+
2. Install <br>
|
|
40
|
+
```pip install .```
|
|
41
|
+
- in a virtual env or use `--break-system-package`
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
This script allows you to download content from the Wayback Machine (archive.org). You can use it to download either the latest version or all versions of web page snapshots within a specified range.
|
|
46
|
+
|
|
47
|
+
### Arguments
|
|
48
|
+
|
|
49
|
+
- `-h`, `--help`: Show the help message and exit.
|
|
50
|
+
- `-a`, `--about`: Show information about the script and exit.
|
|
51
|
+
|
|
52
|
+
#### Required Arguments
|
|
53
|
+
|
|
54
|
+
- `-u`, `--url`: The URL of the web page to download. This argument is required.
|
|
55
|
+
|
|
56
|
+
#### Mode Selection (Choose One)
|
|
57
|
+
|
|
58
|
+
- `-c`, `--current`: Download the latest version of each file snapshot. You will get a rebuild of the current website with all available files (but not any original state because new and old versions are mixed).
|
|
59
|
+
- `-f`, `--full`: Download snapshots of all timestamps. You will get a folder per timestamp with the files available at that time.
|
|
60
|
+
- `-s`, `--save`: Save a page to the Wayback Machine. (beta)
|
|
61
|
+
|
|
62
|
+
#### Optional Arguments
|
|
63
|
+
|
|
64
|
+
- `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
|
|
65
|
+
- `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths. Use e.g. to get root-only snapshots.
|
|
66
|
+
- `-o`, `--output`: The folder where downloaded files will be saved.
|
|
67
|
+
|
|
68
|
+
- **Range Selection:**<br>
|
|
69
|
+
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>
|
|
70
|
+
(year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
|
|
71
|
+
- `-r`, `--range`: Specify the range in years for which to search and download snapshots.
|
|
72
|
+
- `--start`: Timestamp to start searching.
|
|
73
|
+
- `--end`: Timestamp to end searching.
|
|
74
|
+
|
|
75
|
+
#### Additional
|
|
76
|
+
|
|
77
|
+
- `--csv`: Save a csv file with the list of snapshots inside the output folder or a specified folder. If you set `--list` the csv will contain the cdx list of snapshots. If you set either `--current` or `--full` the csv will contain the downloaded files.
|
|
78
|
+
- `--no-redirect`: Do not follow redirects of snapshots. Archive.org sometimes redirects to a different snapshot for several reasons. Downloading redirects may lead to timestamp-folders which contain some files with a different timestamp. This does not matter if you only want to download the latest version (`-c`).
|
|
79
|
+
- `--verbosity`: Set the verbosity: json (print json response), progress (show progress bar).
|
|
80
|
+
- `--retry`: Retry failed downloads. You can specify the number of retry attempts as an integer.
|
|
81
|
+
- `--workers`: The number of workers to use for downloading (simultaneous downloads). Default is 1. A safe spot is about 10 workers. Beware: Using too many workers will lead into refused connections from the Wayback Machine. Duration about 1.5 minutes.
|
|
82
|
+
|
|
83
|
+
### Examples
|
|
84
|
+
|
|
85
|
+
Download latest snapshot of all files:<br>
|
|
86
|
+
`waybackup -u http://example.com -c`
|
|
87
|
+
|
|
88
|
+
Download latest snapshot of a specific file:<br>
|
|
89
|
+
`waybackup -u http://example.com/subdir/file.html -c`
|
|
90
|
+
|
|
91
|
+
Download all snapshots sorted per timestamp with a specified range and do not follow redirects:<br>
|
|
92
|
+
`waybackup -u http://example.com -f -r 5 --no-redirect`
|
|
93
|
+
|
|
94
|
+
Download all snapshots sorted per timestamp with a specified range and save to a specified folder with 3 workers:<br>
|
|
95
|
+
`waybackup -u http://example.com -f -r 5 -o /home/user/Downloads/snapshots --workers 3`
|
|
96
|
+
|
|
97
|
+
Download all snapshots from 2020 to 12th of December 2022 with 4 workers, save a csv and show a progress bar:
|
|
98
|
+
`waybackup -u http://example.com -f --start 2020 --end 20221212 --workers 4 --csv --verbosity progress`
|
|
99
|
+
|
|
100
|
+
Download all snapshots and output a json response:<br>
|
|
101
|
+
`waybackup -u http://example.com -f --verbosity json`
|
|
102
|
+
|
|
103
|
+
List available snapshots per timestamp without downloading and save a csv file to home folder:<br>
|
|
104
|
+
`waybackup -u http://example.com -f -l --csv /home/user/Downloads`
|
|
105
|
+
|
|
106
|
+
## Output path structure
|
|
107
|
+
|
|
108
|
+
The output path is currently structured as follows by an example for the query:<br>
|
|
109
|
+
`http://example.com/subdir1/subdir2/assets/`:
|
|
110
|
+
<br><br>
|
|
111
|
+
For the current version (`-c`):
|
|
112
|
+
- The requested path will only include all files/folders starting from your query-path.
|
|
113
|
+
```
|
|
114
|
+
your/path/waybackup_snapshots/
|
|
115
|
+
└── the_root_of_your_query/ (example.com/)
|
|
116
|
+
└── subdir1/
|
|
117
|
+
└── subdir2/
|
|
118
|
+
└── assets/
|
|
119
|
+
├── image.jpg
|
|
120
|
+
├── style.css
|
|
121
|
+
...
|
|
122
|
+
```
|
|
123
|
+
For all versions (`-f`):
|
|
124
|
+
- Will currently create a folder named as the root of your query. Inside this folder, you will find all timestamps and per timestamp the path you requested.
|
|
125
|
+
```
|
|
126
|
+
your/path/waybackup_snapshots/
|
|
127
|
+
└── the_root_of_your_query/ (example.com/)
|
|
128
|
+
├── yyyymmddhhmmss/
|
|
129
|
+
│ ├── subidr1/
|
|
130
|
+
│ │ └── subdir2/
|
|
131
|
+
│ │ └── assets/
|
|
132
|
+
│ │ ├── image.jpg
|
|
133
|
+
│ │ └── style.css
|
|
134
|
+
├── yyyymmddhhmmss/
|
|
135
|
+
│ ├── subdir1/
|
|
136
|
+
│ │ └── subdir2/
|
|
137
|
+
│ │ └── assets/
|
|
138
|
+
│ │ ├── image.jpg
|
|
139
|
+
│ │ └── style.css
|
|
140
|
+
...
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Json Response
|
|
145
|
+
|
|
146
|
+
For download queries:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
[
|
|
150
|
+
{
|
|
151
|
+
"file": "/your/path/waybackup_snapshots/example.com/yyyymmddhhmmss/index.html",
|
|
152
|
+
"id": 1,
|
|
153
|
+
"redirect_timestamp": "yyyymmddhhmmss",
|
|
154
|
+
"redirect_url": "http://web.archive.org/web/yyyymmddhhmmssid_/http://example.com/",
|
|
155
|
+
"response": 200,
|
|
156
|
+
"timestamp": "yyyymmddhhmmss",
|
|
157
|
+
"url_archive": "http://web.archive.org/web/yyyymmddhhmmssid_/http://example.com/",
|
|
158
|
+
"url_origin": "http://example.com/"
|
|
159
|
+
},
|
|
160
|
+
...
|
|
161
|
+
]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
For list queries:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
[
|
|
168
|
+
{
|
|
169
|
+
"digest": "DIGESTOFSNAPSHOT",
|
|
170
|
+
"id": 1,
|
|
171
|
+
"mimetype": "text/html",
|
|
172
|
+
"status": "200",
|
|
173
|
+
"timestamp": "yyyymmddhhmmss",
|
|
174
|
+
"url": "http://example.com/"
|
|
175
|
+
},
|
|
176
|
+
...
|
|
177
|
+
]
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## CSV Output
|
|
181
|
+
|
|
182
|
+
The csv contains the json response in a table format.
|
|
183
|
+
|
|
184
|
+
## Contributing
|
|
185
|
+
|
|
186
|
+
I'm always happy for some feature requests to improve the usability of this script.
|
|
187
|
+
Feel free to give suggestions and report issues. Project is still far from being perfect.
|
pywaybackup-0.8.1/PKG-INFO
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pywaybackup
|
|
3
|
-
Version: 0.8.1
|
|
4
|
-
Summary: Download snapshots from the Wayback Machine
|
|
5
|
-
Home-page: https://github.com/bitdruid/python-wayback-machine-downloader
|
|
6
|
-
Author: bitdruid
|
|
7
|
-
Author-email: bitdruid@outlook.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Keywords: wayback machine internet archive
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
|
|
13
|
-
# archive wayback downloader
|
|
14
|
-
|
|
15
|
-
[](https://pypi.org/project/pywaybackup/)
|
|
16
|
-
[](https://pypi.org/project/pywaybackup/)
|
|
17
|
-

|
|
18
|
-

|
|
19
|
-
[](https://opensource.org/licenses/MIT)
|
|
20
|
-
|
|
21
|
-
Downloading archived web pages from the [Wayback Machine](https://archive.org/web/).
|
|
22
|
-
|
|
23
|
-
Internet-archive is a nice source for several OSINT-information. This script is a work in progress to query and fetch archived web pages.
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
### Pip
|
|
28
|
-
|
|
29
|
-
1. Install the package <br>
|
|
30
|
-
```pip install pywaybackup```
|
|
31
|
-
2. Run the script <br>
|
|
32
|
-
```waybackup -h```
|
|
33
|
-
|
|
34
|
-
### Manual
|
|
35
|
-
|
|
36
|
-
1. Clone the repository <br>
|
|
37
|
-
```git clone https://github.com/bitdruid/python-wayback-machine-downloader.git```
|
|
38
|
-
2. Install <br>
|
|
39
|
-
```pip install .```
|
|
40
|
-
- in a virtual env or use `--break-system-package`
|
|
41
|
-
|
|
42
|
-
## Usage
|
|
43
|
-
|
|
44
|
-
This script allows you to download content from the Wayback Machine (archive.org). You can use it to download either the latest version or all versions of web page snapshots within a specified range.
|
|
45
|
-
|
|
46
|
-
<!-- ## Info -->
|
|
47
|
-
|
|
48
|
-
### Arguments
|
|
49
|
-
|
|
50
|
-
- `-h`, `--help`: Show the help message and exit.
|
|
51
|
-
- `-a`, `--about`: Show information about the script and exit.
|
|
52
|
-
|
|
53
|
-
#### Required Arguments
|
|
54
|
-
|
|
55
|
-
- `-u URL`, `--url URL`: The URL of the web page to download. This argument is required.
|
|
56
|
-
|
|
57
|
-
#### Mode Selection (Choose One)
|
|
58
|
-
|
|
59
|
-
- `-c`, `--current`: Download the latest version of each file snapshot. You will get a rebuild of the current website with all available files.
|
|
60
|
-
- `-f`, `--full`: Download snapshots of all timestamps. You will get a folder per timestamp with the files available at that time.
|
|
61
|
-
- `-s`, `--save`: Save a page to the Wayback Machine. (beta)
|
|
62
|
-
|
|
63
|
-
#### Optional Arguments
|
|
64
|
-
|
|
65
|
-
- `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
|
|
66
|
-
- `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths.
|
|
67
|
-
- `-o OUTPUT`, `--output OUTPUT`: The folder where downloaded files will be saved.
|
|
68
|
-
|
|
69
|
-
- **Range Selection:**<br>
|
|
70
|
-
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>
|
|
71
|
-
(year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
|
|
72
|
-
- `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
|
|
73
|
-
- `--start`: Timestamp to start searching.
|
|
74
|
-
- `--end`: Timestamp to end searching.
|
|
75
|
-
|
|
76
|
-
#### Additional
|
|
77
|
-
|
|
78
|
-
- `--csv`: Save a csv file with the list of snapshots inside the output folder.
|
|
79
|
-
- `--no-redirect`: Do not follow redirects of snapshots. Archive.org sometimes redirects to a different snapshot for several reasons. Downloading redirects may lead to timestamp-folders which contain some files with a different timestamp. This does not matter if you only want to download the latest version (`-c`).
|
|
80
|
-
- `--verbosity [LEVEL]`: Set the verbosity: json (print json response), progress (show progress bar) or standard (default).
|
|
81
|
-
- `--retry [RETRY_FAILED]`: Retry failed downloads. You can specify the number of retry attempts as an integer.
|
|
82
|
-
- `--worker [AMOUNT]`: The number of worker to use for downloading (simultaneous downloads). Default is 1. A safe spot is about 10 workers. Beware: Using too many worker will lead into refused connections from the Wayback Machine. Duration about 1.5 minutes.
|
|
83
|
-
|
|
84
|
-
### Examples
|
|
85
|
-
|
|
86
|
-
Download latest snapshot of all files:<br>
|
|
87
|
-
`waybackup -u http://example.com -c`
|
|
88
|
-
|
|
89
|
-
Download latest snapshot of all files with retries:<br>
|
|
90
|
-
`waybackup -u http://example.com -c --retry 3`
|
|
91
|
-
|
|
92
|
-
Download all snapshots sorted per timestamp with a specified range and follow redirects:<br>
|
|
93
|
-
`waybackup -u http://example.com -f -r 5 --redirect`
|
|
94
|
-
|
|
95
|
-
Download all snapshots sorted per timestamp with a specified range and save to a specified folder with 3 worker:<br>
|
|
96
|
-
`waybackup -u http://example.com -f -r 5 -o /home/user/Downloads/snapshots --worker 3`
|
|
97
|
-
|
|
98
|
-
List available snapshots per timestamp without downloading:<br>
|
|
99
|
-
`waybackup -u http://example.com -f -l`
|
|
100
|
-
|
|
101
|
-
## Contributing
|
|
102
|
-
|
|
103
|
-
I'm always happy for some feature requests to improve the usability of this script.
|
|
104
|
-
Feel free to give suggestions and report issues. Project is still far from being perfect.
|
pywaybackup-0.8.1/README.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# archive wayback downloader
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/pywaybackup/)
|
|
4
|
-
[](https://pypi.org/project/pywaybackup/)
|
|
5
|
-

|
|
6
|
-

|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
|
|
9
|
-
Downloading archived web pages from the [Wayback Machine](https://archive.org/web/).
|
|
10
|
-
|
|
11
|
-
Internet-archive is a nice source for several OSINT-information. This script is a work in progress to query and fetch archived web pages.
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
### Pip
|
|
16
|
-
|
|
17
|
-
1. Install the package <br>
|
|
18
|
-
```pip install pywaybackup```
|
|
19
|
-
2. Run the script <br>
|
|
20
|
-
```waybackup -h```
|
|
21
|
-
|
|
22
|
-
### Manual
|
|
23
|
-
|
|
24
|
-
1. Clone the repository <br>
|
|
25
|
-
```git clone https://github.com/bitdruid/python-wayback-machine-downloader.git```
|
|
26
|
-
2. Install <br>
|
|
27
|
-
```pip install .```
|
|
28
|
-
- in a virtual env or use `--break-system-package`
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
This script allows you to download content from the Wayback Machine (archive.org). You can use it to download either the latest version or all versions of web page snapshots within a specified range.
|
|
33
|
-
|
|
34
|
-
<!-- ## Info -->
|
|
35
|
-
|
|
36
|
-
### Arguments
|
|
37
|
-
|
|
38
|
-
- `-h`, `--help`: Show the help message and exit.
|
|
39
|
-
- `-a`, `--about`: Show information about the script and exit.
|
|
40
|
-
|
|
41
|
-
#### Required Arguments
|
|
42
|
-
|
|
43
|
-
- `-u URL`, `--url URL`: The URL of the web page to download. This argument is required.
|
|
44
|
-
|
|
45
|
-
#### Mode Selection (Choose One)
|
|
46
|
-
|
|
47
|
-
- `-c`, `--current`: Download the latest version of each file snapshot. You will get a rebuild of the current website with all available files.
|
|
48
|
-
- `-f`, `--full`: Download snapshots of all timestamps. You will get a folder per timestamp with the files available at that time.
|
|
49
|
-
- `-s`, `--save`: Save a page to the Wayback Machine. (beta)
|
|
50
|
-
|
|
51
|
-
#### Optional Arguments
|
|
52
|
-
|
|
53
|
-
- `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
|
|
54
|
-
- `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths.
|
|
55
|
-
- `-o OUTPUT`, `--output OUTPUT`: The folder where downloaded files will be saved.
|
|
56
|
-
|
|
57
|
-
- **Range Selection:**<br>
|
|
58
|
-
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>
|
|
59
|
-
(year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
|
|
60
|
-
- `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
|
|
61
|
-
- `--start`: Timestamp to start searching.
|
|
62
|
-
- `--end`: Timestamp to end searching.
|
|
63
|
-
|
|
64
|
-
#### Additional
|
|
65
|
-
|
|
66
|
-
- `--csv`: Save a csv file with the list of snapshots inside the output folder.
|
|
67
|
-
- `--no-redirect`: Do not follow redirects of snapshots. Archive.org sometimes redirects to a different snapshot for several reasons. Downloading redirects may lead to timestamp-folders which contain some files with a different timestamp. This does not matter if you only want to download the latest version (`-c`).
|
|
68
|
-
- `--verbosity [LEVEL]`: Set the verbosity: json (print json response), progress (show progress bar) or standard (default).
|
|
69
|
-
- `--retry [RETRY_FAILED]`: Retry failed downloads. You can specify the number of retry attempts as an integer.
|
|
70
|
-
- `--worker [AMOUNT]`: The number of worker to use for downloading (simultaneous downloads). Default is 1. A safe spot is about 10 workers. Beware: Using too many worker will lead into refused connections from the Wayback Machine. Duration about 1.5 minutes.
|
|
71
|
-
|
|
72
|
-
### Examples
|
|
73
|
-
|
|
74
|
-
Download latest snapshot of all files:<br>
|
|
75
|
-
`waybackup -u http://example.com -c`
|
|
76
|
-
|
|
77
|
-
Download latest snapshot of all files with retries:<br>
|
|
78
|
-
`waybackup -u http://example.com -c --retry 3`
|
|
79
|
-
|
|
80
|
-
Download all snapshots sorted per timestamp with a specified range and follow redirects:<br>
|
|
81
|
-
`waybackup -u http://example.com -f -r 5 --redirect`
|
|
82
|
-
|
|
83
|
-
Download all snapshots sorted per timestamp with a specified range and save to a specified folder with 3 worker:<br>
|
|
84
|
-
`waybackup -u http://example.com -f -r 5 -o /home/user/Downloads/snapshots --worker 3`
|
|
85
|
-
|
|
86
|
-
List available snapshots per timestamp without downloading:<br>
|
|
87
|
-
`waybackup -u http://example.com -f -l`
|
|
88
|
-
|
|
89
|
-
## Contributing
|
|
90
|
-
|
|
91
|
-
I'm always happy for some feature requests to improve the usability of this script.
|
|
92
|
-
Feel free to give suggestions and report issues. Project is still far from being perfect.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.8.1"
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: pywaybackup
|
|
3
|
-
Version: 0.8.1
|
|
4
|
-
Summary: Download snapshots from the Wayback Machine
|
|
5
|
-
Home-page: https://github.com/bitdruid/python-wayback-machine-downloader
|
|
6
|
-
Author: bitdruid
|
|
7
|
-
Author-email: bitdruid@outlook.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Keywords: wayback machine internet archive
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
|
|
13
|
-
# archive wayback downloader
|
|
14
|
-
|
|
15
|
-
[](https://pypi.org/project/pywaybackup/)
|
|
16
|
-
[](https://pypi.org/project/pywaybackup/)
|
|
17
|
-

|
|
18
|
-

|
|
19
|
-
[](https://opensource.org/licenses/MIT)
|
|
20
|
-
|
|
21
|
-
Downloading archived web pages from the [Wayback Machine](https://archive.org/web/).
|
|
22
|
-
|
|
23
|
-
Internet-archive is a nice source for several OSINT-information. This script is a work in progress to query and fetch archived web pages.
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
### Pip
|
|
28
|
-
|
|
29
|
-
1. Install the package <br>
|
|
30
|
-
```pip install pywaybackup```
|
|
31
|
-
2. Run the script <br>
|
|
32
|
-
```waybackup -h```
|
|
33
|
-
|
|
34
|
-
### Manual
|
|
35
|
-
|
|
36
|
-
1. Clone the repository <br>
|
|
37
|
-
```git clone https://github.com/bitdruid/python-wayback-machine-downloader.git```
|
|
38
|
-
2. Install <br>
|
|
39
|
-
```pip install .```
|
|
40
|
-
- in a virtual env or use `--break-system-package`
|
|
41
|
-
|
|
42
|
-
## Usage
|
|
43
|
-
|
|
44
|
-
This script allows you to download content from the Wayback Machine (archive.org). You can use it to download either the latest version or all versions of web page snapshots within a specified range.
|
|
45
|
-
|
|
46
|
-
<!-- ## Info -->
|
|
47
|
-
|
|
48
|
-
### Arguments
|
|
49
|
-
|
|
50
|
-
- `-h`, `--help`: Show the help message and exit.
|
|
51
|
-
- `-a`, `--about`: Show information about the script and exit.
|
|
52
|
-
|
|
53
|
-
#### Required Arguments
|
|
54
|
-
|
|
55
|
-
- `-u URL`, `--url URL`: The URL of the web page to download. This argument is required.
|
|
56
|
-
|
|
57
|
-
#### Mode Selection (Choose One)
|
|
58
|
-
|
|
59
|
-
- `-c`, `--current`: Download the latest version of each file snapshot. You will get a rebuild of the current website with all available files.
|
|
60
|
-
- `-f`, `--full`: Download snapshots of all timestamps. You will get a folder per timestamp with the files available at that time.
|
|
61
|
-
- `-s`, `--save`: Save a page to the Wayback Machine. (beta)
|
|
62
|
-
|
|
63
|
-
#### Optional Arguments
|
|
64
|
-
|
|
65
|
-
- `-l`, `--list`: Only print the snapshots available within the specified range. Does not download the snapshots.
|
|
66
|
-
- `-e`, `--explicit`: Only download the explicit given url. No wildcard subdomains or paths.
|
|
67
|
-
- `-o OUTPUT`, `--output OUTPUT`: The folder where downloaded files will be saved.
|
|
68
|
-
|
|
69
|
-
- **Range Selection:**<br>
|
|
70
|
-
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>
|
|
71
|
-
(year 2019, year+month 201901, year+month+day 20190101, year+month+day+hour 2019010112)
|
|
72
|
-
- `-r RANGE`, `--range RANGE`: Specify the range in years for which to search and download snapshots.
|
|
73
|
-
- `--start`: Timestamp to start searching.
|
|
74
|
-
- `--end`: Timestamp to end searching.
|
|
75
|
-
|
|
76
|
-
#### Additional
|
|
77
|
-
|
|
78
|
-
- `--csv`: Save a csv file with the list of snapshots inside the output folder.
|
|
79
|
-
- `--no-redirect`: Do not follow redirects of snapshots. Archive.org sometimes redirects to a different snapshot for several reasons. Downloading redirects may lead to timestamp-folders which contain some files with a different timestamp. This does not matter if you only want to download the latest version (`-c`).
|
|
80
|
-
- `--verbosity [LEVEL]`: Set the verbosity: json (print json response), progress (show progress bar) or standard (default).
|
|
81
|
-
- `--retry [RETRY_FAILED]`: Retry failed downloads. You can specify the number of retry attempts as an integer.
|
|
82
|
-
- `--worker [AMOUNT]`: The number of worker to use for downloading (simultaneous downloads). Default is 1. A safe spot is about 10 workers. Beware: Using too many worker will lead into refused connections from the Wayback Machine. Duration about 1.5 minutes.
|
|
83
|
-
|
|
84
|
-
### Examples
|
|
85
|
-
|
|
86
|
-
Download latest snapshot of all files:<br>
|
|
87
|
-
`waybackup -u http://example.com -c`
|
|
88
|
-
|
|
89
|
-
Download latest snapshot of all files with retries:<br>
|
|
90
|
-
`waybackup -u http://example.com -c --retry 3`
|
|
91
|
-
|
|
92
|
-
Download all snapshots sorted per timestamp with a specified range and follow redirects:<br>
|
|
93
|
-
`waybackup -u http://example.com -f -r 5 --redirect`
|
|
94
|
-
|
|
95
|
-
Download all snapshots sorted per timestamp with a specified range and save to a specified folder with 3 worker:<br>
|
|
96
|
-
`waybackup -u http://example.com -f -r 5 -o /home/user/Downloads/snapshots --worker 3`
|
|
97
|
-
|
|
98
|
-
List available snapshots per timestamp without downloading:<br>
|
|
99
|
-
`waybackup -u http://example.com -f -l`
|
|
100
|
-
|
|
101
|
-
## Contributing
|
|
102
|
-
|
|
103
|
-
I'm always happy for some feature requests to improve the usability of this script.
|
|
104
|
-
Feel free to give suggestions and report issues. Project is still far from being perfect.
|
|
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
|