From ee397ba462a73e50959642a47819ec78cfd195ee Mon Sep 17 00:00:00 2001 From: Yoongi Kim Date: Tue, 13 Aug 2019 03:25:30 +0900 Subject: [PATCH] google full update for new site --- collect_links.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/collect_links.py b/collect_links.py index 575962d..d58a794 100644 --- a/collect_links.py +++ b/collect_links.py @@ -201,14 +201,15 @@ def google_full(self, keyword, add_url=""): while True: try: - imgs = self.browser.find_elements(By.XPATH, '//div[@class="irc_c i8187 immersive-container irc-rcd"]//img[@class="irc_mi"]') + xpath = '//div[@class="irc_c i8187 immersive-container"]//img[@class="irc_mi"]' + imgs = self.browser.find_elements(By.XPATH, xpath) for img in imgs: src = img.get_attribute('src') if src not in links and src is not None: links.append(src) - print('%d: %s'%(count, src)) + print('%d: %s' % (count, src)) count += 1 except StaleElementReferenceException: @@ -257,8 +258,8 @@ def naver_full(self, keyword, add_url=""): while True: try: - imgs = self.browser.find_elements(By.XPATH, - '//div[@class="image_viewer_wrap _sauImageViewer"]//img[@class="_image_source"]') + xpath = '//div[@class="image_viewer_wrap _sauImageViewer"]//img[@class="_image_source"]' + imgs = self.browser.find_elements(By.XPATH, xpath) for img in imgs: src = img.get_attribute('src')