summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir@cohens.org.il>2017-11-29 08:29:19 +0200
committerTzafrir Cohen <tzafrir@cohens.org.il>2017-11-29 08:29:19 +0200
commit3cfeeb935ddc06ab0680529bbd3c3ffcfc4c129b (patch)
tree36dc655dbe4f715db39ba64f17d3fdd8777cc180
parent6da19b06559bab3a56438fb2bfa8340ac069c3a6 (diff)
Get also show description
Not used so far
-rw-r--r--default.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/default.py b/default.py
index 5ea7394..8a82b01 100644
--- a/default.py
+++ b/default.py
@@ -101,13 +101,15 @@ def read_url(url):
return response.text
-def get_show_title(base_url, path):
+def get_show_info(base_url, path):
url = base_url + '/' + path
page = read_url(url)
parsed = BeautifulSoup(page, "html.parser")
title = parsed.title.string
title = re.sub('[|-].*', '', title)
- return title
+ desc_div = parsed.find('div', class_='program_top_txt')
+ desc = desc_div.text
+ return (title, desc)
def title_checksum(title):
@@ -128,7 +130,7 @@ def get_program_item(res_array, page, a, i):
"""
path = a.get('href')
show_id = re.sub('.*=', '', path)
- title = get_show_title(KAN_URL, path)
+ title, desc = get_show_info(KAN_URL, path)
checksum = title_checksum(title)
url = page.build_url({'mode': 'show', 'id': show_id,
'checksum': str(checksum)})