diff --git a/finviz/helper_functions/scraper_functions.py b/finviz/helper_functions/scraper_functions.py index 573fa0a..afee99b 100644 --- a/finviz/helper_functions/scraper_functions.py +++ b/finviz/helper_functions/scraper_functions.py @@ -40,17 +40,10 @@ def get_table(page_html: requests.Response, headers, rows=None, **kwargs): def get_total_rows(page_content): """ Returns the total number of rows(results). """ - - total_element = page_content.cssselect('td[width="128"]') - if len(total_element) > 0: - content = etree.tostring(total_element[0]).decode("utf-8") - total_number = content.split("/")[1].split()[0] - - try: - return int(total_number) - except ValueError: - return 0 - else: + total_number = str(html.tostring(page_content)).split('class="count-text">#1 / ')[1].split(' Total')[0] + try: + return int(total_number) + except ValueError: return 0