Created
June 28, 2017 09:29
-
-
Save erika-dike/9cd967f044c0409b0a3a2c81c6eec212 to your computer and use it in GitHub Desktop.
Auto download images from site
This file contains hidden or 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
| import os | |
| def make_dir(dirname): | |
| current_path = os.getcwd() | |
| path = os.path.join(current_path, dirname) | |
| if not os.path.exists(path): | |
| os.makedirs(path) | |
| if __name__ == '__main__': | |
| driver = init_driver() | |
| image_links = get_all_download_links( | |
| driver, 'https://quotefancy.com/wallace-d-wattles-quotes') | |
| time.sleep(5) | |
| driver.quit() | |
| dirname = 'imgs' | |
| make_dir(dirname) | |
| download_images('https://quotefancy.com', dirname, image_links) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment