Geocrack

tv-programm

Jul 23rd, 2022
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. import requests
  3. from fpdf import FPDF
  4.  
  5.  
  6. pdf = FPDF()
  7. pdf.add_page()
  8. pdf.set_font('Arial', 'B', 16)
  9. page = requests.get("https://www.hoerzu.de/text/tv-programm/hoerfilm.php")
  10.  
  11. if page.status_code == 200:
  12.     content = page.content
  13.  
  14. soup = BeautifulSoup(content, "html.parser")
  15. banned = ["KiKA,", "ORF1", "ORF2","ORF3","ORFSport","SRF1","SRF2"]
  16.  
  17. x = soup.findAll('a')
  18. for item in x:
  19.     if item.getText() == '' or item.getText() == "Zur Navigation" or item.getText() == "nach oben":
  20.         continue
  21.     g = ""
  22.     for j in item.getText().split(" ")[4:6]:
  23.         g += j
  24.  
  25.     if g in banned:
  26.         continue
  27.     pdf.cell(0, 8, item.getText(), 0, 1)
  28.  
  29. pdf.output('senderliste.pdf', 'F')
Advertisement
Add Comment
Please, Sign In to add comment