|
| 1 | +# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license |
| 2 | + |
1 | 3 | # Bing Images and Google Images web scraper |
2 | 4 | # Requires chromedriver. Download from https://chromedriver.chromium.org/ |
3 | 5 |
|
@@ -373,7 +375,7 @@ def user_input(): |
373 | 375 | # args.chromedriver = './chromedriver' |
374 | 376 |
|
375 | 377 | if args.search: # construct url |
376 | | - args.url = f'https://www.bing.com/images/search?q={args.search.replace(" ", "%20")}' |
| 378 | + args.url = f"https://www.bing.com/images/search?q={args.search.replace(' ', '%20')}" |
377 | 379 | args.image_directory = args.search.replace(" ", "_") |
378 | 380 |
|
379 | 381 | arguments = vars(args) |
@@ -469,7 +471,7 @@ def get_next_tab(self, s): |
469 | 471 | start_line = s.find('class="dtviD"') |
470 | 472 | start_content = s.find('href="', start_line + 1) |
471 | 473 | end_content = s.find('">', start_content + 1) |
472 | | - url_item = f"https://www.google.com{str(s[start_content + 6:end_content])}" |
| 474 | + url_item = f"https://www.google.com{str(s[start_content + 6 : end_content])}" |
473 | 475 | url_item = url_item.replace("&", "&") |
474 | 476 |
|
475 | 477 | start_line_2 = s.find('class="dtviD"') |
@@ -799,7 +801,7 @@ def keywords_from_file(self, file_name): |
799 | 801 | line.replace("\n", "").replace("\r", "") for line in f if line not in ["\n", "\r\n"] |
800 | 802 | ) |
801 | 803 | else: |
802 | | - print("Invalid file type: Valid file types are either .txt or .csv \n" "exiting...") |
| 804 | + print("Invalid file type: Valid file types are either .txt or .csv \nexiting...") |
803 | 805 | sys.exit() |
804 | 806 | return search_keyword |
805 | 807 |
|
|
0 commit comments