Compare commits

..

No commits in common. "61f679eb2d72143db28372e224ee2c7aca9b2814" and "5a978d2f90f6db5a77e4a25bd1157eb47e3b8279" have entirely different histories.

1 changed files with 4 additions and 7 deletions

View File

@ -15,9 +15,8 @@ GALLERIES_URL = f'{BASE_URL}{GALLERIES_PATH}'
TARGET_DIR = Path(__file__).resolve().parent.parent / 'content' / 'galerie' TARGET_DIR = Path(__file__).resolve().parent.parent / 'content' / 'galerie'
DATE_PATTERN = r'([DFMS]\w+, \d{1,2}. [ADFJMNOS]\w+ \d{4})' DATE_PATTERN = r'[DFMS]\w+, \d{1,2}. [ADFJMNOS]\w+ \d{4}'
DATE_RANGE_SEPARATOR_PATTERN = r'bis\s+<.+>' DATE_RANGE_PATTERN = f'({DATE_PATTERN})(?:| bis ({DATE_PATTERN}))'
DATE_RANGE_PATTERN = f'{DATE_RANGE_SEPARATOR_PATTERN}{DATE_PATTERN}'
MONTH_NAMES = ('Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember') MONTH_NAMES = ('Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember')
MONTHS = {month: str(i+1).zfill(2) for i, month in enumerate(MONTH_NAMES)} MONTHS = {month: str(i+1).zfill(2) for i, month in enumerate(MONTH_NAMES)}
@ -43,9 +42,7 @@ def download_gallery(path):
r.raise_for_status() r.raise_for_status()
date = search(DATE_RANGE_PATTERN, r.text) date = search(DATE_RANGE_PATTERN, r.text)
if date is None: date = convert_date(date[2] if date[2] else date[1])
date = search(DATE_PATTERN, r.text)
date = convert_date(date[1])
soup = BeautifulSoup(r.text, 'html.parser') soup = BeautifulSoup(r.text, 'html.parser')
minify_whitespace(soup) minify_whitespace(soup)
@ -58,7 +55,7 @@ def download_gallery(path):
index = target / 'index.md' index = target / 'index.md'
index.write_text(f'''--- index.write_text(f'''---
slug: "{slug}" slug: "{slug}"
title: {dump(title, Dumper=CDumper).rstrip()} title: {dump(title, Dumper=CDumper)}
date: {date} date: {date}
--- ---