Merge branch 'master' of cvs.moegen-wir.net:neingeist/dirty-helpers
commit
011f5f8a90
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# recursively delete empty directories
|
||||
|
||||
rmdir_empty() {
|
||||
# make default . explicit
|
||||
if [ -z "$1" ]; then
|
||||
set -- .
|
||||
fi
|
||||
|
||||
find "$@" -depth \
|
||||
-path "." -prune -or \
|
||||
-type d -empty -exec rmdir -v {} \;
|
||||
}
|
||||
|
||||
rmdir_empty "$@"
|
@ -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