A Smart, Automatic, Fast and Lightweight Web Scraper for Python
Python aiartificial-intelligenceautomationcrawlermachine-learningpythonscrapescraperscrapingweb-scrapingwebautomationwebscraping
Remove unused get_random_str
Mikaeec33398f292
diff --git a/autoscraper/auto_scraper.py b/autoscraper/auto_scraper.pyindex 4227e6b..73f90a6 100644--- a/autoscraper/auto_scraper.py+++ b/autoscraper/auto_scraper.py@@ -11,7 +11,6 @@ from autoscraper.utils import (FuzzyText,ResultItem,get_non_rec_text,- get_random_str,normalize,text_match,unique_hashable,@@ -294,7 +293,7 @@ class AutoScraper(object):)stack["url"] = url if is_full_url else ""stack["hash"] = hashlib.sha256(str(stack).encode("utf-8")).hexdigest()- stack["stack_id"] = "rule_" + get_random_str(4)+ stack["stack_id"] = "rule_" + stack["hash"][:8]return stackdef _get_result_for_child(self, child, soup, url):diff --git a/autoscraper/utils.py b/autoscraper/utils.pyindex 5193708..15641f6 100644--- a/autoscraper/utils.py+++ b/autoscraper/utils.py@@ -1,7 +1,5 @@from collections import OrderedDict-import random-import stringimport unicodedatafrom difflib import SequenceMatcher@@ -24,11 +22,6 @@ def unique_hashable(hashable_items):return list(OrderedDict.fromkeys(hashable_items))-def get_random_str(n):- chars = string.ascii_lowercase + string.digits- return ''.join(random.choice(chars) for i in range(n))--def get_non_rec_text(element):return ''.join(element.find_all(text=True, recursive=False)).strip()