-
Notifications
You must be signed in to change notification settings - Fork 79
Migrate to Python 3 #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Migrate to Python 3 #110
Conversation
- Convert to Python 3 exclusively - Restructure code into classes (Soundtrack, Song, AudioFile) - Add type hints - Use pathlib for path operations - Implement context managers for resource handling - Introduce custom exception classes for better error reporting - Use persistent HTTP sessions for improved performance - Spoof Chrome user agent and set Referer to avoid 403 errors (compliant with robots.txt) - Stream downloads with chunked transfers - Refactor CLI with argparse - Add verbose mode for detailed progress - Sanitize filenames to avoid filesystem issues
…umentation - Reformat to comply with Google Python style guide: - Consistent docstrings, type hints, constants, and naming conventions - Restructure core classes (AudioFile, Song, Soundtrack) for clarity and reuse - Introduce `--images` / `download_images` option to fetch album artwork - Enhance CLI parsing and error handling (invalid formats, network retries) - Update README.md with usage examples and API docs - Add requirements.txt pinning `requests` and `beautifulsoup4`
Deleted false statements copied from template.
Revised Library and API sections of the README to reflect changes in the Python 3 migration.
Cleaned up superfluity in the README.
|
Lgtm, works well |
This should lower the barrier for complete beginners and ensure a smooth first-time experience.
…, update 2nd docs example to minecraft, since kh3 was broken.
|
Oh, beautiful. Most everything anyone’s ever wanted implemented, isn’t it. Before you merge this, would you like to implement the search functionality of the original ( |
|
I'll add search back, I didn't realize I deleted it in my version! Also, do you think it's a good or bad idea to add progress bars? I wasn't sure, but if you'd like it, I'm very glad to add it. |
|
Please do! ❤️ It’d be nice to have the freaky auto-package installation that’s in the original, as well – the script is meant to be as friendly as possible to non-technical users (…while still being a command-line tool), which is why that unusual feature was in there. Saves me/you/whoever from reports about Pip not being on someone's PATH, too. I’d prefer it to Oh, and so as not to surprise users who upgrade (and again, to be user-friendly), could you make the verbose mode the default, and add a |
|
Wilco, I'll ditch the requirements.txt for automatic package installation (I'll find out the best way to do that) and make verbose the default. |
|
You are a saint. ❤️ |
|
Ooh, one more thing I just noticed: Downloading images should be default, to match the expectation set by the existing version. So perhaps make that |
|
I'll make downloading images the default. I had changed it because I don't like downloading images haha, but it makes more sense to have continuity, yes. |
|
Feel free to add an environment variable or something if you want it default on your end, of course! (Might be overcomplicating it, though. Do as you see fit!) |
|
For some reason it this fork doesn't accept whole link as parameter, says album not found.
If I only put album name, it actually does download but progress not shown at all. |
Thanks for letting me know, I'll investigate that. |
Tried tqdm, but it was FAR too slow, created no-deps implementation.
|
I believe I have addressed everything you brought up! Let me know if you spot anything else. |
Migrate the codebase to Python 3.7+, remove all Python 2 compatibility shims, and modernize core logic and documentation.
Strip surrounding quotes from the output path argument before directory creation -> Fixes #55
Drop reliance on a missing #pageContent container and parse directly from the full soup -> Fixes #71
Sanitize and normalize output paths with pathlib.Path.mkdir(parents=True), removing illegal Windows characters (e.g., colons) -> Fixes #72
Switched to chunked, streaming downloads with a 30 s timeout for large files -> Fixes #75
Detect “No such album” via a text search instead of relying on find('p').string -> Fixes #81
Extract the album ID from a full KHInsider URL before CLI parsing -> Fixes #82
Updated README with clear, step-by-step installation and usage instructions for beginners -> Fixes #85
Ensure the output directory (and any missing parent folders) is created before writing each file -> Fixes #89
Guard against a missing
songlisttable before iterating rows -> Fixes #90Added requirements.txt -> Fixes #95
Removed the Python 2 unicodePrint wrapper and now use native print with UTF-8 support -> Fixes #96
Guard against a missing
songlisttable before iterating rows -> Fixes #100Includes a user agent string spoofer to circumvent their new anti-web-scraping. Still fully robots.txt compliant. ->Fixes #100 | Fixes #101 | Fixes #104 | Fixes #105