ksvmuralidhar
commited on
Commit
•
d9f2c79
1
Parent(s):
0d3223b
Update scraper.py
Browse files- scraper.py +2 -0
scraper.py
CHANGED
@@ -29,6 +29,7 @@ def get_text(url, n_words=15):
|
|
29 |
sent = sent.strip()
|
30 |
if (len(sent.split()) >= n_words) and (len(re.findall(r"^\w.+[^\w\)\s]$", sent))>0):
|
31 |
sentence_list.append(sent)
|
|
|
32 |
driver.quit()
|
33 |
logging.warning("Closed Webdriver")
|
34 |
logging.warning("Successfully scraped text")
|
@@ -39,6 +40,7 @@ def get_text(url, n_words=15):
|
|
39 |
logging.warning(str(e))
|
40 |
if driver:
|
41 |
driver.close()
|
|
|
42 |
logging.warning("Closed Webdriver")
|
43 |
err_msg = str(e).split('\n')[0]
|
44 |
return "", err_msg
|
|
|
29 |
sent = sent.strip()
|
30 |
if (len(sent.split()) >= n_words) and (len(re.findall(r"^\w.+[^\w\)\s]$", sent))>0):
|
31 |
sentence_list.append(sent)
|
32 |
+
driver.close()
|
33 |
driver.quit()
|
34 |
logging.warning("Closed Webdriver")
|
35 |
logging.warning("Successfully scraped text")
|
|
|
40 |
logging.warning(str(e))
|
41 |
if driver:
|
42 |
driver.close()
|
43 |
+
driver.quit()
|
44 |
logging.warning("Closed Webdriver")
|
45 |
err_msg = str(e).split('\n')[0]
|
46 |
return "", err_msg
|