Remove Duplicate Imports: You've imported the os module twice. We can remove one of them.
Use a Set for Extensions: Using a set for HARDCODED_EXTENSIONS can improve the has_extension function's performance as set membership checks are faster than list checks.
Improve Command-Line Argument Handling: We can simplify the command-line argument handling by combining similar actions into functions and avoiding redundant checks.
Remove Redundant Logging Configurations: You can simplify the logging configuration and avoid repetition.
Use F-Strings for Logging: Use f-strings for logging messages to improve readability.
Avoid Redundant File Operations: Avoid reading and writing the same file multiple times. You can collect URLs in memory and write them to the file once.