Created
December 12, 2020 23:48
-
-
Save MrJoshFisher/536f7c4617e14cc508c637c867028dc8 to your computer and use it in GitHub Desktop.
[Selenium] #selenium
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
#!/usr/bin/python | |
import os | |
import urllib | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.chrome.options import Options | |
chrome_options = Options() | |
chrome_options.add_argument("--headless") | |
chrome_options.binary_location = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' | |
f = open("textfile.txt", "r") | |
for x in f: | |
filName = x.rstrip() | |
year = x.split('/')[0] | |
month = x.split('/')[1] | |
imgFile = x.split('/')[2] | |
path = year + '/' + month | |
try: | |
os.mkdir(path) | |
urllib.urlretrieve(filName,path + '/' + imgFile) | |
except Exception: | |
print Exception | |
print x | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment