✨ wiewardertatort
parent
036fd39041
commit
aca0f41d65
@ -0,0 +1,29 @@
|
|||||||
|
#!/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:
|
Loading…
Reference in New Issue