-
Notifications
You must be signed in to change notification settings - Fork 0
/
scraper_script.py
34 lines (29 loc) · 1.03 KB
/
scraper_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import scrapers.treehugger as treehugger
import scrapers.zerowastehome as zerowastehome
import datetime
all_sites = ['treehugger', 'zerowastehome']
def run_scrapers(recent_articles):
'''
Input: recent_articles is a dictionary of site names whose values are the most recent article put in the table
Runs all invidual scrapers and returns them in one list
Scrapers: treehugger, zerowastehome
'''
th = treehugger.scrape_treehugger(recent_articles['treehugger'])
zwh = zerowastehome.scrape_zerowastehome(recent_articles['zerowastehome'])
return th + zwh
if __name__ == "__main__":
test_article = {
'url': "",
'title':"",
'author':"",
'image_url':"",
'publish_date' : datetime.datetime(1,1,1),
'site_title': "",
}
rec_art = {
'treehugger': test_article,
'zerowastehome': test_article,
}
rs = run_scrapers(rec_art)
print('Number of articles: ', len(rs))
print(rs)