Compare commits
No commits in common. "251b8fc0a6a96065b74bcb5336b7f6374c9fc7d8" and "c58d698574cee66a4b8197d9b762a09e52e1f1cf" have entirely different histories.
251b8fc0a6
...
c58d698574
@ -1,7 +1,3 @@
|
||||
## How to use
|
||||
|
||||
1. Clone repo
|
||||
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
|
||||
4. Download the relevant chromedriver required for your chrome install
|
||||
# magic-download-images
|
||||
|
||||
Download images for magic the gathering cards
|
@ -1,29 +0,0 @@
|
||||
# Generated by Selenium IDE
|
||||
import time
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
options = webdriver.ChromeOptions()
|
||||
prefs = {"download.default_directory" : "/home/rodude123/Downloads/mtg/"}
|
||||
options.add_experimental_option("prefs",prefs)
|
||||
options.add_argument("--headless")
|
||||
driver = webdriver.Chrome(executable_path='./chromedriver', options=options)
|
||||
driver.set_window_size(1280, 720)
|
||||
arr = []
|
||||
|
||||
with open('cards.txt') as f:
|
||||
for line in f:
|
||||
arr.append(line.strip())
|
||||
|
||||
for i in range(1, len(arr)):
|
||||
try:
|
||||
driver.get("https://scryfall.com/")
|
||||
driver.find_element(By.ID, "q").send_keys(arr[i])
|
||||
driver.find_element(By.ID, "q").send_keys(Keys.ENTER)
|
||||
time.sleep(1)
|
||||
driver.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/div[3]/ul/li[1]/a").click()
|
||||
time.sleep(1)
|
||||
except Exception as e:
|
||||
print(arr[i])
|
||||
continue
|
Loading…
Reference in New Issue
Block a user