Created
August 9, 2023 07:33
-
-
Save ErykDarnowski/4d70c2b0305d01fdfe525deef29903fa to your computer and use it in GitHub Desktop.
Open URLs from a text file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import webbrowser | |
delay = 0.2 | |
incognito_mode = True | |
input_filename = 'input.txt' # <- any URLs separated by `\n` | |
browser_path = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe %s' + (' --incognito' if incognito_mode else '') | |
# Reading lines from file anad opening each URL in the browser: | |
counter = 0 | |
lines = open(input_filename, 'r').readlines() | |
for link in lines: | |
counter += 1 | |
time.sleep(delay) | |
link = link.rstrip() | |
print(f'{counter}. {link}') | |
webbrowser.get(browser_path).open_new(link) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment