Skip to content

Instantly share code, notes, and snippets.

@MrJoshFisher
Created December 12, 2020 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrJoshFisher/536f7c4617e14cc508c637c867028dc8 to your computer and use it in GitHub Desktop.
Save MrJoshFisher/536f7c4617e14cc508c637c867028dc8 to your computer and use it in GitHub Desktop.
[Selenium] #selenium
#!/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