summaryrefslogtreecommitdiffstats
path: root/ddg-imager-taker
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-11 20:46:08 -0600
committermsglm <msglm@techchud.xyz>2023-01-11 20:46:08 -0600
commit09db67368639ac0b3e510dbf0380d73bd40e2fcd (patch)
tree171ad1fe3f59fc79ba8285642fec74775f92c9b4 /ddg-imager-taker
parentaec07bd49003ecbab647065d04f528582cf1905d (diff)
downloadddg-image-grabber-09db67368639ac0b3e510dbf0380d73bd40e2fcd.tar.gz
ddg-image-grabber-09db67368639ac0b3e510dbf0380d73bd40e2fcd.tar.bz2
ddg-image-grabber-09db67368639ac0b3e510dbf0380d73bd40e2fcd.zip
rename
Diffstat (limited to 'ddg-imager-taker')
-rwxr-xr-xddg-imager-taker91
1 files changed, 0 insertions, 91 deletions
diff --git a/ddg-imager-taker b/ddg-imager-taker
deleted file mode 100755
index c68817f..0000000
--- a/ddg-imager-taker
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/python3
-import argparse
-import urllib.request
-from os.path import basename
-
-parser = argparse.ArgumentParser(add_help=True)
-parser.add_argument('--output','-o',
- default=".",
- dest='outputDir',
- action="store",
- help="location to save to",
- type=str
- )
-parser.add_argument('--amount','-a',
- default=100,
- dest='amount',
- action="store",
- help="the amount of images you'd like to download",
- type=int
- )
-parser.add_argument('URLs',
- nargs='+',
- type=str,
- help='Site to query'
- )
-
-
-
-args = parser.parse_args()
-
-from time import sleep
-from selenium import webdriver
-from selenium.webdriver.chrome.options import Options
-from selenium.webdriver.common.by import By
-chrome_options = Options()
-chrome_options.add_argument("--headless")
-driver = webdriver.Chrome(options=chrome_options)
-SourceURLs=[]
-driver.implicitly_wait(1)
-
-def getSource():
- print("Opening...")
- AllPortraitThumbnails[element].click()
- SourceURLs.append(driver.find_element(By.XPATH, "/html/body/div[2]/div[3]/div/div[2]/div/div[1]/div[1]/div/div[2]/div/div/a").get_attribute('href'))
-
-
-for url in args.URLs:
- driver.get(url)
- sleep(3)
- AllPortraitThumbnails = driver.find_elements(By.XPATH, "/html/body/div[2]/div[3]/div/div[1]/div[2]/div/./div")
-
- for element in range(args.amount):
- print("Obtaining element number " + str(element))
- try:
- if element % 100 == 0 and element != 0:
- sleep(5)
- getSource()
- else:
- getSource()
- except:
- AllPortraitThumbnails = driver.find_elements(By.XPATH, "/html/body/div[2]/div[3]/div/div[1]/div[2]/div/./div")
- sleep(5)
-
-
-print("Starting Download...")
-driver.quit()
-
-
-for sourceURL in SourceURLs:
- name = basename(sourceURL)
- try:
- print("Downloading " + name)
- urllib.request.urlretrieve(sourceURL, args.outputDir + "/" + name)
- except KeyboardInterrupt:
- print("KeyboardInterrupt Detected!")
- driver.quit()
- quit(1)
- except:
- pass
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License version 3 as published by
-# the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.