mirror of
https://github.com/simon987/od-database.git
synced 2025-12-14 15:19:03 +00:00
Should fix memory usage problem when crawling
This commit is contained in:
@@ -36,7 +36,7 @@ class HttpDirectory(RemoteDirectory):
|
||||
|
||||
def __init__(self, url):
|
||||
super().__init__(url)
|
||||
self.parser = etree.HTMLParser(collect_ids=False)
|
||||
self.parser = etree.HTMLParser(collect_ids=False, encoding='utf-8')
|
||||
|
||||
def list_dir(self, path) -> list:
|
||||
results = []
|
||||
@@ -103,7 +103,7 @@ class HttpDirectory(RemoteDirectory):
|
||||
while retries > 0:
|
||||
try:
|
||||
r = requests.get(url, headers=HttpDirectory.HEADERS)
|
||||
return r.content
|
||||
return r.text
|
||||
except RequestException:
|
||||
retries -= 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user