Last active
April 3, 2022 00:58
-
-
Save jakebox/5337dd78e52d1313a9e0e1211a11f356 to your computer and use it in GitHub Desktop.
Automates clicking on images in Google Images, saving them, and saving their link. A program I wrote to download a bunch of images to make a video for history class that required source links.
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
### | |
### Google Images photo & link saver | |
### By Jake B - May 2020 | |
### | |
import clipboard as clipboard | |
import pyautogui as pag | |
import time | |
f = open("sources.txt", "a") | |
desired_images = 15 | |
pag.PAUSE = 0.065 | |
speed_adj = 1.1 # Speed multiplier (increase for more less wait (faster computer)) | |
time.sleep(3) | |
for i in range(desired_images): | |
# Go to the save button and save the image | |
pag.click(button='right') | |
pag.press('down', presses=6) | |
pag.press('enter') | |
time.sleep(0.7 / speed_adj) | |
pag.press('enter') | |
time.sleep(2 / speed_adj) | |
# Copying and saving the link to a file | |
pag.click(button='right') | |
pag.press('down', presses=8) | |
time.sleep(0.3 / speed_adj) | |
pag.press('enter') | |
time.sleep(0.5 / speed_adj) | |
f.write(clipboard.paste() + "\n") | |
# Moving to a new picture | |
pag.press('right') | |
time.sleep(0.5 / speed_adj) |
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
To use this program, first use Chrome in incognito mode. Open a Google Images search on your desired topic, and click on an image to go into a larger view where you can move with the arrow keys. Then, run program, focus Chrome and place cursor above center of the image. Let it do its magic – images will be saved to wherever you last downloaded something, and their links will be written to a sources.txt file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment