Spaces:
Sleeping
Sleeping
ksvmuralidhar
commited on
Commit
•
152aad4
1
Parent(s):
00f3071
Update scraper.py
Browse files- scraper.py +2 -0
scraper.py
CHANGED
@@ -28,6 +28,8 @@ def scrape_text(url, n_words=15):
|
|
28 |
driver.quit()
|
29 |
logging.warning("Closed Webdriver")
|
30 |
logging.warning("Successfully scraped text")
|
|
|
|
|
31 |
return " \n\n\n".join(sentence_list)
|
32 |
except:
|
33 |
if driver:
|
|
|
28 |
driver.quit()
|
29 |
logging.warning("Closed Webdriver")
|
30 |
logging.warning("Successfully scraped text")
|
31 |
+
if len(sentence_list) < 3:
|
32 |
+
raise Exception("Found nothing to scrape.")
|
33 |
return " \n\n\n".join(sentence_list)
|
34 |
except:
|
35 |
if driver:
|