You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f7034db
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+46-18Lines changed: 46 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,26 @@
2
2
3
3
Some small Python utilities.
4
4
5
+
To use them, make sure you also downloaded `util.py` file from the same directory (or better, just clone the whole repo).
6
+
7
+
5
8
## `instalive.py`
6
9
7
-
Instagram live downloader. Feed in MPD URL (including all the query parameters!) within 24 hour and it can download the full live stream from the beginning.
10
+
Instagram live downloader. Feed in MPD URL (including all the query parameters!) within ~~24~~ (a few) hours and it can download the full live stream from the beginning.
all - Download both video and audio, and merge them (default)
16
-
live - Download the live stream only
18
+
all - Download both video and audio (including live and backtracking), and then merge them (default)
19
+
live - Download the live stream only (no backtracking)
17
20
video - Download video only
18
21
audio - Download audio only
19
22
merge - Merge downloaded video and audio
20
-
check - Check the downloaded segments to make sure there is no missing segments
21
-
manual - Manually process a specified range (used together with --range)
23
+
check - Check the downloaded segments to make sure there are no missing segments
24
+
manual - Manually check missing segments at the largest gap (or use --range to assign a range) (for debugging only)
22
25
info - Display downloader object info
23
26
import:<path> - Import segments downloaded via N_m3u8DL-RE from a given path
24
27
@@ -29,16 +32,21 @@ options:
29
32
-h, --help show this help message and exit
30
33
--action ACTION, -a ACTION
31
34
action to perform (default: all)
32
-
--dir DIR, -d DIR save path (default: CWD)
35
+
--dir DIR, -d DIR save path (default: instalive_{mpd_id})
33
36
--debug debug mode
34
37
--quality QUALITY, -q QUALITY
35
-
manually assign video quality (default: auto)
36
-
--time TIME, -t TIME manually assign last t (default: auto)
37
-
--range RANGE manually assign range (start,end) for quick iterate test mode
38
+
manually assign video quality by quality name.
39
+
(default: "pst": which is the "original" (?) and has the best bitrate,
40
+
but not necessarily the highest resolution.
41
+
Pass empty string or "highest" to use the highest resolution one.)
42
+
--time TIME, -t TIME for debugging only; manually assign last t (default: auto)
43
+
--range RANGE for debugging only; manually assign iteration range (start,end) for manual action
38
44
```
39
45
40
46
## `oricon.py`
41
47
48
+
** Deprecated: You can no longer get original size of images from Oricon website AFAIK. The random quality toggling because of CDN is also gone (?). This can still be used to download the images in the size shown on the webpage, though. **
49
+
42
50
Quickly download all the highest quality pictures from any Oricon news, special or photo article.
The actual downloading is delegated to [minyami](https://github.com/Last-Order/Minyami) and/or [N_m3u8DL-RE](https://github.com/nilaoda/N_m3u8DL-RE), so make sure you have them installed first.
144
+
The actual downloading is delegated to [minyami](https://github.com/Last-Order/Minyami) and/or [N_m3u8DL-RE](https://github.com/nilaoda/N_m3u8DL-RE), so make sure you have them installed first and available in your PATH.
145
+
146
+
It also can reads the arguments from a `nico.txt` file in the CWD or the same directory as the script. Syntax: just put all the arguments in one line.
Specify the directory to save the downloaded files. [Default: current directory]
163
175
--reserve Automatically reserve timeshift ticket if not reserved yet. [Default: no]
176
+
--simulate Simulate the download process without actually downloading.
164
177
```
165
178
166
179
## `util.py`
@@ -169,8 +182,23 @@ Some utility functions mainly for myself. Read the code to get the idea.
169
182
170
183
Some highlights:
171
184
172
-
* download - a generic downloader
173
-
* format_str - format a string to certain width and alignment. Supports wide characters like Chinese and Japanese.
174
-
* compare_obj - recursively compare two objects.
175
-
* Table - a simple table class.
176
-
* parse_to_shortdate - parse a date string to a short date string ('%y%m%d'). Supports more East Asian language formats than `dateutil.parser`.
185
+
**Network & Web Scraping:**
186
+
***download** - a comprehensive file downloader with retry logic, duplicate handling (skip/overwrite/rename), referer support, and automatic filename detection from URLs or response headers
187
+
***get** - a convenience wrapper around requests that returns a BeautifulSoup object with retry logic built-in
188
+
***requests_retry_session** - create a requests session with automatic retry on network failures
189
+
***load_cookie** - load cookies from browser (Chrome/Firefox/Edge), cookie files (Netscape format), or cookie strings
190
+
191
+
**File Operations:**
192
+
***safeify** - sanitize filenames by replacing illegal characters with full-width equivalents (yes I know safeify isn't a real word. It was blindly copied from another project and It was too much effort to change it)
193
+
***move_or_delete_duplicate** - move files with smart duplicate detection via hash comparison
194
+
***dump_json/load_json** - convenient JSON file I/O with proper encoding and formatting
195
+
196
+
**Data Structures & Formatting:**
197
+
***Table** - a simple table class with sorting, searching, filtering, and pretty printing capabilities
198
+
***format_str** - format a string to certain width and alignment. Supports wide characters like Chinese and Japanese
199
+
***compare_obj** - recursively compare two objects (dicts, lists, etc.) and print differences with rich formatting
200
+
***rprint** - print function using the rich library for colored and styled terminal output
201
+
202
+
**Date & Time:**
203
+
***MyTime** - a datetime wrapper that makes timezone conversions easy (local, JST, naive)
204
+
***parse_to_shortdate** - parse a date string to a short date string ('%y%m%d'). Supports more East Asian language formats than `dateutil.parser`
0 commit comments