You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
673 B
Python

#!/usr/bin/env python3
import requests
import re
import click
from bs4 import BeautifulSoup
@click.command()
@click.argument('search_title')
def search(search_title):
q = requests.utils.quote(search_title)
url = f"https://www.wiewardertatort.de/search?q={q}"
soup = BeautifulSoup(requests.get(url).text, features="lxml")
for post_outer in soup.select("div.post-outer"):
title = post_outer.select_one("h3.post-title").a.text
print(title)
if m := re.search(r"Bewertung: (\d+)/", post_outer.text):
bewertung = int(m.group(1))
print(bewertung)
if __name__ == '__main__':
search()
# vim:ft=python:tw=120: