I tried several ways to get Fed press conference transcrips ( a PDF format) and convert it to a .txt file, but fail. Below is my original code. Any suggestion will be highly appreciated.
import csv
from bs4 import BeautifulSoup
import requests
source=requests.get('https://www.federalreserve.gov/monetarypolicy/fomccalendars.htm').text
soup=BeautifulSoup(source,'lxml')
for b in soup.find_all("a",href=True):
if b.text=='Press Conference':
lnk='https://www.federalreserve.gov'+b['href']
source2=requests.get(lnk).text
soup2=BeautifulSoup(source2,'lxml')
for c in soup2.find_all("a",href=True):
if 'Press Conference Transcript'in c.text:
lnk2='https://www.federalreserve.gov'+c['href']
source3=requests.get(lnk2).text
soup3=BeautifulSoup(source3,'lxml')
for d in soup3.find_all("div",attrs={"id","content"}):
print(d)
fileout = open('conf.txt', 'a')
fileout.write(d)