Updated downloadimages.py to better support the card names and fixed a bug so that it would start from 0 no 1 in the array. Also updated the README.md to better help them on how to use it
This commit is contained in:
parent
251b8fc0a6
commit
123bd05a5a
@ -4,4 +4,6 @@
|
|||||||
2. Install selenium using `pip install selenium`
|
2. Install selenium using `pip install selenium`
|
||||||
3. Create cards.txt which is next to downloadimages.py. Each card has to be line by line
|
3. Create cards.txt which is next to downloadimages.py. Each card has to be line by line
|
||||||
4. Download the relevant chromedriver required for your chrome install
|
4. Download the relevant chromedriver required for your chrome install
|
||||||
|
5. Open downloadimages.py and change the variable `defaultDir` to a directory of your choosing
|
||||||
|
6. Before you run make sure all slashes have been changed to relevant alternate slashes if on windows so `/` to `\`
|
||||||
|
7. Run in terminal using this command `python downloadimages.py` assuming you are in the directory of the repo
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# Generated by Selenium IDE
|
|
||||||
import time
|
import time
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
@ -16,10 +15,11 @@ with open('cards.txt') as f:
|
|||||||
for line in f:
|
for line in f:
|
||||||
arr.append(line.strip())
|
arr.append(line.strip())
|
||||||
|
|
||||||
for i in range(1, len(arr)):
|
print("These are the cards that couldn't be downloaded")
|
||||||
|
for i in range(0, len(arr)):
|
||||||
try:
|
try:
|
||||||
driver.get("https://scryfall.com/")
|
driver.get("https://scryfall.com/")
|
||||||
driver.find_element(By.ID, "q").send_keys(arr[i])
|
driver.find_element(By.ID, "q").send_keys('"'+ arr[i] + '"')
|
||||||
driver.find_element(By.ID, "q").send_keys(Keys.ENTER)
|
driver.find_element(By.ID, "q").send_keys(Keys.ENTER)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
driver.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/div[3]/ul/li[1]/a").click()
|
driver.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/div[3]/ul/li[1]/a").click()
|
||||||
@ -27,3 +27,4 @@ for i in range(1, len(arr)):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(arr[i])
|
print(arr[i])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user