On corrige de petites erreurs dasn la gestion des cookies fb
This commit is contained in:
parent
9475c99e0f
commit
d3cd57edaf
@ -244,10 +244,19 @@ class FacebookEventExtractor(Extractor):
|
|||||||
from selenium.webdriver.support import expected_conditions as EC
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
|
|
||||||
path = './/div[not(@aria-hidden)]/div[@aria-label="Allow all cookies"]'
|
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)))
|
try:
|
||||||
button = downloader.driver.find_element(By.XPATH, path)
|
element = WebDriverWait(downloader.driver, 15).until(EC.visibility_of_element_located((By.XPATH, path)))
|
||||||
button.click()
|
except Exception as e:
|
||||||
t.sleep(3)
|
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):
|
def prepare_2nd_extract(self):
|
||||||
FacebookEventExtractor.prepare_2nd_extract_dler(self.downloader)
|
FacebookEventExtractor.prepare_2nd_extract_dler(self.downloader)
|
||||||
|
@ -262,7 +262,7 @@ class TwoStepsExtractor(Extractor):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# some website (FB) sometime need a second step
|
# 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')
|
logger.info('Using cookie trick on a facebook event')
|
||||||
first = False
|
first = False
|
||||||
self.prepare_2nd_extract_in_list()
|
self.prepare_2nd_extract_in_list()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user