Last active
August 20, 2018 10:30
-
-
Save wapj/d1804ec42056e793ed5f149a88f9a2b8 to your computer and use it in GitHub Desktop.
pycon2018_slides.py
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 requests | |
from bs4 import BeautifulSoup | |
URL = 'https://www.pycon.kr/2018/program/schedule/' | |
def get_html(url): | |
r = requests.get(url) | |
if r.status_code == 200: | |
return r.text | |
return None | |
html = get_html(URL) | |
soup = BeautifulSoup(html, 'html.parser') | |
programs = soup.find_all("div", {"class": "program"}) | |
def get_slide(program): | |
if program.find("small") and program.find("small").a: | |
return program.find("small").a.get('href') | |
return None | |
for program in programs: | |
slide_url = get_slide(program) | |
if slide_url: | |
title = program.find("div").text.strip() | |
href = "https://www.pycon.kr/" + program.find("a").get("href") | |
print("### [{}]({})".format(title, href )) | |
print(slide_url) | |
print("") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
아래의 커맨드로 문서를 만듭니다.
python pycon_slide.py > pycon_slides.md