Created
October 24, 2019 07:56
-
-
Save amiskov/c70f110632640858ea0872bf7cceee98 to your computer and use it in GitHub Desktop.
Show today's Idioteka pucture.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import webbrowser | |
import datetime | |
import urllib.request | |
today = datetime.date.today() | |
date_uri = f"{today.year}/{today.month}/{today.day}" | |
page_url = 'https://www.artlebedev.ru/kovodstvo/idioteka/' + date_uri | |
pic_re = r'https:\/\/img\.artlebedev\.ru\/kovodstvo\/idioteka\/i\/[A-Z0-9-]*.jpg' | |
with urllib.request.urlopen(page_url) as response: | |
html = response.read().decode('utf-8') | |
url = re.search(pic_re, html).group() | |
webbrowser.open(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment