Ejemplo n.º 1
0
    def get_table(self, driver) -> BytesIO:
        clicks = [(By.XPATH, ".//span[@class='button cookie-law-accept']")]
        xp = './/div[contains(@class, "tableWrapper")]'
        
        image = selenium_driver.get_image(driver, self.url + "#standings;table;overall", xp, delete=FLASH_SCORE_ADS,
                                          clicks=clicks, failure_message="No table found for this league.")

        return image
Ejemplo n.º 2
0
 def get_table(self, driver) -> BytesIO:
     xp = './/div[contains(@class, "tableWrapper")]/parent::div'
     table_page = self.link + "/standings/"
     
     err = f"No table found on {table_page}"
     image = selenium_driver.get_image(driver, table_page, xp, failure_message=err, delete=FLASH_SCORE_ADS)
     self.fetch_logo(driver)
     return image
Ejemplo n.º 3
0
 def bracket(self, driver) -> BytesIO:
     xp = './/div[@class="overview"]'
     clicks = [(By.XPATH, ".//span[@class='button cookie-law-accept']")]
     script = "var element = document.getElementsByClassName('overview')[0];" \
              "element.style.position = 'fixed';element.style.backgroundColor = '#ddd';" \
              "element.style.zIndex = '999';"
     image = selenium_driver.get_image(driver, self.url + "#draw", xpath=xp, clicks=clicks, delete=FLASH_SCORE_ADS,
                                       script=script, failure_message="Unable to find bracket for that tournament.")
     return image
Ejemplo n.º 4
0
 def formation(self, driver) -> BytesIO:
     delete = [(By.XPATH, './/div[@id="lsid-window-mask"]')]
     xp = './/div[@id="lineups-content"]'
     image = selenium_driver.get_image(
         driver,
         self.url + "#lineups;1",
         xp,
         delete=delete,
         failure_message="Unable to find formations for this match")
     return image
Ejemplo n.º 5
0
 def stats_image(self, driver) -> BytesIO:
     delete = [(By.XPATH, './/div[@id="lsid-window-mask"]')]
     xp = ".//div[@class='statBox']"
     image = selenium_driver.get_image(
         driver,
         self.url + "#match-statistics;0",
         xp,
         delete=delete,
         failure_message="Unable to find live stats for this match.")
     return image
Ejemplo n.º 6
0
 def summary(self, driver) -> BytesIO:
     delete = [(By.XPATH, './/div[@id="lsid-window-mask"]')]
     xp = ".//div[@id='summary-content']"
     image = selenium_driver.get_image(
         driver,
         self.url + "#match-summary",
         xp,
         delete=delete,
         failure_message="Unable to find summary for this match")
     return image
Ejemplo n.º 7
0
 def bracket(self, driver) -> BytesIO:
     url = self.link + "/draw/"
     xp = './/div[@id="box-table-type--1"]'
     multi = (By.PARTIAL_LINK_TEXT, 'scroll right »')
     clicks = [(By.XPATH, ".//span[@class='button cookie-law-accept']")]
     script = "document.getElementsByClassName('playoff-scroll-button')[0].style.display = 'none';" \
              "document.getElementsByClassName('playoff-scroll-button')[1].style.display = 'none';"
     captures = selenium_driver.get_image(driver, url, xpath=xp, clicks=clicks, delete=FLASH_SCORE_ADS,
                                          multi_capture=(multi, script),
                                          failure_message="Unable to find a bracket for that competition")
     self.fetch_logo(driver)  # For base_embed.
     
     return image_utils.stitch(captures)
Ejemplo n.º 8
0
    def table(self, driver):
        delete = [(By.XPATH, './/div[@class="seoAdWrapper"]'),
                  (By.XPATH, './/div[@class="banner--sticky"]'),
                  (By.XPATH, './/div[@class="box_over_content"]')]
        err = "No table found for this league."
        xp = './/div[@class="table__wrapper"]'

        image = selenium_driver.get_image(driver,
                                          self.url +
                                          "#standings;table;overall",
                                          xp,
                                          delete=delete,
                                          failure_message=err)
        return image
Ejemplo n.º 9
0
 def table(self, driver) -> BytesIO:
     xp = './/div[@class="table__wrapper"]'
     clicks = [(By.XPATH, ".//span[@class='button cookie-law-accept']")]
     delete = [(By.XPATH, './/div[@class="seoAdWrapper"]'),
               (By.XPATH, './/div[@class="banner--sticky"]'),
               (By.XPATH, './/div[@class="box_over_content"]')]
     err = f"No table found on {self.link}"
     image = selenium_driver.get_image(driver,
                                       self.link + "/standings/",
                                       xp,
                                       err,
                                       clicks=clicks,
                                       delete=delete)
     self.fetch_logo(driver)
     return image
Ejemplo n.º 10
0
 def bracket(self, driver):
     xp = './/div[@class="overview"]'
     clicks = [(By.XPATH, ".//span[@class='button cookie-law-accept']")]
     delete = [(By.XPATH, './/div[@class="seoAdWrapper"]'),
               (By.XPATH, './/div[@class="banner--sticky"]'),
               (By.XPATH, './/div[@class="adsenvelope"]'),
               (By.XPATH, './/div[contains(@class, "rollbar")]')]
     script = "var element = document.getElementsByClassName('overview')[0];" \
              "element.style.position = 'fixed';element.style.backgroundColor = '#ddd';" \
              "element.style.zIndex = '999';"
     image = selenium_driver.get_image(
         driver,
         self.url + "#draw",
         xpath=xp,
         clicks=clicks,
         delete=delete,
         script=script,
         failure_message="Unable to find a bracket for that competition")
     return image
Ejemplo n.º 11
0
 def summary(self, driver) -> BytesIO:
     xp = ".//div[@id='summary-content']"
     image = selenium_driver.get_image(driver, self.url + "#match-summary", xp, delete=FLASH_SCORE_ADS,
                                       failure_message="Unable to find summary for this match")
     return image
Ejemplo n.º 12
0
 def get_formation(self, driver) -> BytesIO:
     clicks = [(By.XPATH, './/div[@id="onetrust-accept-btn-handler"]')]
     xp = './/div[@id="lineups-content"]'
     image = selenium_driver.get_image(driver, self.url + "#lineups;1", xp, delete=FLASH_SCORE_ADS, clicks=clicks,
                                       failure_message="Unable to find formations for this match")
     return image
Ejemplo n.º 13
0
 def stats_image(self, driver) -> BytesIO:
     xp = ".//div[@class='statBFox']"
     image = selenium_driver.get_image(driver, self.url + "#match-statistics;0", xp, delete=FLASH_SCORE_ADS,
                                       failure_message="Unable to find live stats for this match.")
     return image
Ejemplo n.º 14
0
 def get_badge(self, driver, team) -> BytesIO:
     xp = f'.//div[contains(@class, tlogo-{team})]//img'
     badge = selenium_driver.get_image(driver, self.url, xpath=xp, failure_message="Badge not found.")
     return badge