-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from isaacholtis/isaac
Isaac
- Loading branch information
Showing
2 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<html> | ||
|
||
<head> | ||
|
||
<title>Keep your browser open.</title> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<p>This page opened to keep your browser window open while the bing bot completes it's searches. It can be safely closed once the searches have completed.</p> | ||
|
||
</body> | ||
|
||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
import webbrowser | ||
import random | ||
from random import randint | ||
import pyautogui | ||
import time | ||
import threading | ||
|
||
searchNum = int(input("Please input the number of tabs you want to open.\nPlease note that the more tabs you open the more ram you will use, and we are not responsible for your computer crashing.\n-->")) | ||
# Define webOpenSearch, which is used for threading so that multiple tabs can be opened at once. | ||
def webOpenSearch(n, n2): | ||
for i in range(n): | ||
webbrowser.open(f"https://www.bing.com/search?q={randint(1,2000)}") | ||
time.sleep(n2) | ||
pyautogui.hotkey('ctrl', 'w') | ||
# Get a variable to tell the system how many tabs to open. | ||
searchNum = int(input("Please input the number of tabs you want to open.\nEach tab will open once, and then close, so feel free to do as many as you want!\n-->")) | ||
# Get a variable to tell the system how long to wait before closing a tab. | ||
# Note that I can't get the tabs to close well, with the system usually only closing one or two tabs. | ||
timeNum = int(input("Please input how long you'd like to wait between searches.\nToo short of a time may cause the page to fail to load.\n-->")) | ||
|
||
num = 0 | ||
webLink = [] | ||
# Opens a web page to keep the browser window open, for lighter resource usage, and faster operation. | ||
webbrowser.open("Dep1Browser.html") | ||
time.sleep(3) | ||
# Create a for loop that makes the threads needed to have multiple tabs open, using searchNum to detirmine how many there are. | ||
for i in range(searchNum): | ||
webLink.append(f"https://www.bing.com/search?q={(i + 1)}") | ||
for i in range(searchNum): | ||
webbrowser.open (webLink[i]) | ||
print(webLink) | ||
i = threading.Thread(target=webOpenSearch, args=(searchNum,timeNum)) | ||
i.start() |