On corrige de petites erreurs dasn la gestion des cookies fb
This commit is contained in:
		@@ -244,10 +244,19 @@ class FacebookEventExtractor(Extractor):
 | 
			
		||||
            from selenium.webdriver.support import expected_conditions as EC
 | 
			
		||||
 | 
			
		||||
            path = './/div[not(@aria-hidden)]/div[@aria-label="Allow all cookies"]'
 | 
			
		||||
            element = WebDriverWait(downloader.driver, 10).until(EC.visibility_of_element_located((By.XPATH, path)))
 | 
			
		||||
            button = downloader.driver.find_element(By.XPATH, path)
 | 
			
		||||
            button.click()
 | 
			
		||||
            t.sleep(3)
 | 
			
		||||
            try:
 | 
			
		||||
                element = WebDriverWait(downloader.driver, 15).until(EC.visibility_of_element_located((By.XPATH, path)))
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                raise Exception(_("Error while waiting for the cookie button to be visible: " + e.__class__.__name__ + ' ' + str(e)))
 | 
			
		||||
            try:
 | 
			
		||||
                button = downloader.driver.find_element(By.XPATH, path)
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                raise Exception(_("Error while getting the cookie button to be visible: " + e.__class__.__name__ + ' ' + str(e)))
 | 
			
		||||
            try:
 | 
			
		||||
                button.click()
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                raise Exception(_("Error while clicking on the cookie button to be visible: " + e.__class__.__name__ + ' ' + str(e)))
 | 
			
		||||
            t.sleep(5)
 | 
			
		||||
 | 
			
		||||
    def prepare_2nd_extract(self):
 | 
			
		||||
        FacebookEventExtractor.prepare_2nd_extract_dler(self.downloader)
 | 
			
		||||
 
 | 
			
		||||
@@ -262,7 +262,7 @@ class TwoStepsExtractor(Extractor):
 | 
			
		||||
                    )
 | 
			
		||||
                except Exception as e:
 | 
			
		||||
                    # some website (FB) sometime need a second step
 | 
			
		||||
                    if first and len(self.events) == 0 and self.has_2nd_method_in_list and self.downloader.support_2nd_extract:
 | 
			
		||||
                    if first and self.has_2nd_method_in_list and self.downloader.support_2nd_extract:
 | 
			
		||||
                        logger.info('Using cookie trick on a facebook event')
 | 
			
		||||
                        first = False
 | 
			
		||||
                        self.prepare_2nd_extract_in_list()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user