Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- import requests
- from fpdf import FPDF
- pdf = FPDF()
- pdf.add_page()
- pdf.set_font('Arial', 'B', 16)
- page = requests.get("https://www.hoerzu.de/text/tv-programm/hoerfilm.php")
- if page.status_code == 200:
- content = page.content
- soup = BeautifulSoup(content, "html.parser")
- banned = ["KiKA,", "ORF1", "ORF2","ORF3","ORFSport","SRF1","SRF2"]
- x = soup.findAll('a')
- for item in x:
- if item.getText() == '' or item.getText() == "Zur Navigation" or item.getText() == "nach oben":
- continue
- g = ""
- for j in item.getText().split(" ")[4:6]:
- g += j
- if g in banned:
- continue
- pdf.cell(0, 8, item.getText(), 0, 1)
- pdf.output('senderliste.pdf', 'F')
Advertisement
Add Comment
Please, Sign In to add comment