Skip to content

Instantly share code, notes, and snippets.

@leoriviera
Last active February 23, 2021 16:12
Show Gist options
  • Save leoriviera/78360141807eecf7643b84f892699e5d to your computer and use it in GitHub Desktop.
Save leoriviera/78360141807eecf7643b84f892699e5d to your computer and use it in GitHub Desktop.
A utility to open domains from a text file using the default browser
import subprocess
import webbrowser
def open_page(page_url):
webbrowser.open(page_url)
filename = input('Default file name is page-list.txt. Enter file name if different.\n')
# incognitoOn = input('Incognito mode on? y/N\n')
# incognitoOn = '-incognito' if incognitoOn == 'y' else ''
filename = filename if filename != '' else 'page-list.txt'
try:
fileObj = open(filename, 'r')
lines = fileObj.readlines()
for i in range(0, len(lines)):
page_url = lines[i].strip()
print(page_url)
if(i % 10 == 0 and i != 0):
input('Hit enter to continue.\n')
open_page(page_url)
except Exception as e:
print(e)
input()
exit()
input('Program complete.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment