Skip to content

Instantly share code, notes, and snippets.

@amiskov
Created October 24, 2019 07:56
Show Gist options
  • Save amiskov/c70f110632640858ea0872bf7cceee98 to your computer and use it in GitHub Desktop.
Save amiskov/c70f110632640858ea0872bf7cceee98 to your computer and use it in GitHub Desktop.
Show today's Idioteka pucture.
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