In [73]:
#Bread & butter
import pandas as pd
from itertools import product
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver import ActionChains
from selenium.webdriver.chrome.options import Options
In [74]:
# define URLs & datapoints to scrape
obama_briefing_url='https://2009-2017.state.gov/r/pa/prs/dpb/'
trump_briefing_url='https://www.state.gov/r/pa/prs/dpb/'
obamaYearList=['2013','2014','2015','2016']
trumpYearList=['2017','2018']
monthList=['01','02','03','04','05','06','07','08','09','10','11','12']
briefing_df=pd.DataFrame(columns=['Year','Month','Day','President','Tick_Color'])


# Set basic driver options. Minimum logging
chrome_options = Options()
chrome_options.add_argument('--log-level=3')
driver = webdriver.Chrome("C:\chromedriver_win32\chromedriver.exe")
In [76]:
# Scrape data for 'Daily' press briefings for first 2 years of Obama administration

obamaYearMonth=list(product(obamaYearList,monthList))

for yearMonth in obamaYearMonth:
    print(obama_briefing_url+yearMonth[0]+"/"+yearMonth[1])
    link=obama_briefing_url+yearMonth[0]+"/"+yearMonth[1]
    driver.get(link)
    allDays=driver.find_elements_by_xpath('//li[@class="day"]')
    allBriefingDays=driver.find_elements_by_xpath('//a[@class="view"]')
    print(str(len(allDays))+"----------"+str(len(allBriefingDays)))
    dayNum=0
    for day in allDays:
        dayNum+=1
        #print(day.find_elements_by_class_name('view'))
        if((day.find_elements_by_class_name('view'))):            
            print(str(dayNum)+'------ Press Briefing Present')
            briefing_df.loc[len(briefing_df)]=[yearMonth[0],yearMonth[1],dayNum,'Obama','Blue']
    
    
  
    
https://2009-2017.state.gov/r/pa/prs/dpb/2013/01
31----------17
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
22------ Press Briefing Present
25------ Press Briefing Present
28------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/02
28----------17
1------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
19------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/03
31----------17
1------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
22------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/04
30----------18
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
12------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/05
31----------19
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
6------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
20------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/06
30----------20
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/07
31----------21
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/08
31----------17
1------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/09
30----------12
5------ Press Briefing Present
6------ Press Briefing Present
9------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/10
31----------22
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/11
30----------14
1------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2013/12
31----------15
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
9------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/01
31----------19
2------ Press Briefing Present
3------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
27------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/02
28----------14
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
14------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/03
31----------17
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
14------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/04
30----------21
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
7------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/05
31----------16
1------ Press Briefing Present
2------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
27------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/06
30----------20
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
20------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/07
31----------19
1------ Press Briefing Present
2------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/08
31----------16
4------ Press Briefing Present
5------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/09
30----------13
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
12------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
19------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/10
31----------22
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/11
30----------15
3------ Press Briefing Present
4------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
10------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2014/12
31----------17
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
8------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/01
31----------18
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/02
28----------16
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
23------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/03
31----------19
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
6------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/04
30----------20
3------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/05
31----------20
1------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/06
30----------21
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/07
31----------17
1------ Press Briefing Present
2------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
13------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
24------ Press Briefing Present
27------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/08
31----------17
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/09
30----------14
1------ Press Briefing Present
3------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
24------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/10
31----------19
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/11
30----------16
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
13------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2015/12
31----------17
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/01
31----------15
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/02
29----------17
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
22------ Press Briefing Present
26------ Press Briefing Present
29------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/03
31----------21
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/04
30----------20
1------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/05
31----------20
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/06
30----------22
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/07
31----------19
1------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/08
31----------18
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/09
30----------15
1------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/10
31----------19
3------ Press Briefing Present
4------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
31------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/11
30----------17
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
7------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://2009-2017.state.gov/r/pa/prs/dpb/2016/12
31----------16
1------ Press Briefing Present
2------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
27------ Press Briefing Present
In [79]:
# Scrape data for 'Daily' press briefings for first 2 years of Obama administration

trumpYearMonth=list(product(trumpYearList,monthList))

for yearMonth in trumpYearMonth:
    print(trump_briefing_url+yearMonth[0]+"/"+yearMonth[1])
    link=trump_briefing_url+yearMonth[0]+"/"+yearMonth[1]
    driver.get(link)
    allDays=driver.find_elements_by_xpath('//li[@class="day"]')
    allBriefingDays=driver.find_elements_by_xpath('//a[@class="read"]')
    print(str(len(allDays))+"----------"+str(len(allBriefingDays)))
    dayNum=0
    for day in allDays:
        dayNum+=1
        #print(day.find_elements_by_class_name('view'))
        if((day.find_elements_by_class_name('read'))):            
            print(str(dayNum)+'------ Press Briefing Present')
            briefing_df.loc[len(briefing_df)]=[yearMonth[0],yearMonth[1],dayNum,'Trump','Red']
    
https://www.state.gov/r/pa/prs/dpb/2017/01
31----------0
https://www.state.gov/r/pa/prs/dpb/2017/02
28----------2
3------ Press Briefing Present
13------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/03
31----------16
2------ Press Briefing Present
3------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
23------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/04
30----------12
3------ Press Briefing Present
4------ Press Briefing Present
6------ Press Briefing Present
11------ Press Briefing Present
13------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
20------ Press Briefing Present
24------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/05
31----------9
2------ Press Briefing Present
4------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
15------ Press Briefing Present
23------ Press Briefing Present
30------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/06
30----------14
1------ Press Briefing Present
6------ Press Briefing Present
8------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
15------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
22------ Press Briefing Present
27------ Press Briefing Present
29------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/07
31----------12
5------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
11------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
25------ Press Briefing Present
27------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/08
31----------14
1------ Press Briefing Present
2------ Press Briefing Present
3------ Press Briefing Present
4------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
15------ Press Briefing Present
18------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
24------ Press Briefing Present
31------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/09
30----------13
7------ Press Briefing Present
8------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
18------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/10
31----------19
3------ Press Briefing Present
4------ Press Briefing Present
6------ Press Briefing Present
10------ Press Briefing Present
12------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
24------ Press Briefing Present
26------ Press Briefing Present
27------ Press Briefing Present
31------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/11
30----------14
3------ Press Briefing Present
7------ Press Briefing Present
9------ Press Briefing Present
11------ Press Briefing Present
14------ Press Briefing Present
17------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
28------ Press Briefing Present
30------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2017/12
31----------14
1------ Press Briefing Present
5------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/01
31----------16
2------ Press Briefing Present
4------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
16------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
23------ Press Briefing Present
25------ Press Briefing Present
29------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/02
28----------14
1------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
12------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
20------ Press Briefing Present
22------ Press Briefing Present
27------ Press Briefing Present
28------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/03
31----------12
1------ Press Briefing Present
2------ Press Briefing Present
5------ Press Briefing Present
6------ Press Briefing Present
8------ Press Briefing Present
15------ Press Briefing Present
20------ Press Briefing Present
21------ Press Briefing Present
22------ Press Briefing Present
23------ Press Briefing Present
27------ Press Briefing Present
29------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/04
30----------12
2------ Press Briefing Present
4------ Press Briefing Present
10------ Press Briefing Present
13------ Press Briefing Present
17------ Press Briefing Present
19------ Press Briefing Present
20------ Press Briefing Present
22------ Press Briefing Present
25------ Press Briefing Present
26------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/05
31----------11
3------ Press Briefing Present
8------ Press Briefing Present
11------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
18------ Press Briefing Present
22------ Press Briefing Present
29------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/06
30----------8
5------ Press Briefing Present
7------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
21------ Press Briefing Present
26------ Press Briefing Present
28------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/07
31----------11
2------ Press Briefing Present
3------ Press Briefing Present
5------ Press Briefing Present
10------ Press Briefing Present
12------ Press Briefing Present
18------ Press Briefing Present
19------ Press Briefing Present
24------ Press Briefing Present
31------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/08
31----------12
2------ Press Briefing Present
6------ Press Briefing Present
7------ Press Briefing Present
8------ Press Briefing Present
9------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
16------ Press Briefing Present
17------ Press Briefing Present
23------ Press Briefing Present
28------ Press Briefing Present
29------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/09
30----------6
6------ Press Briefing Present
11------ Press Briefing Present
13------ Press Briefing Present
18------ Press Briefing Present
20------ Press Briefing Present
25------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/10
31----------9
2------ Press Briefing Present
9------ Press Briefing Present
10------ Press Briefing Present
11------ Press Briefing Present
17------ Press Briefing Present
23------ Press Briefing Present
30------ Press Briefing Present
31------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/11
30----------11
1------ Press Briefing Present
2------ Press Briefing Present
7------ Press Briefing Present
13------ Press Briefing Present
14------ Press Briefing Present
15------ Press Briefing Present
20------ Press Briefing Present
27------ Press Briefing Present
29------ Press Briefing Present
https://www.state.gov/r/pa/prs/dpb/2018/12
31----------6
3------ Press Briefing Present
11------ Press Briefing Present
18------ Press Briefing Present
In [80]:
#Save data for plotting

briefing_df.to_csv('Full_Press_Briefing_Data.csv',index=False)
In [ ]: