better title

This commit is contained in:
j 2015-03-15 02:21:56 +05:30
parent c4c0c40825
commit 16a955f310

View file

@ -24,7 +24,7 @@ def get_data(url):
'url': url, 'url': url,
'type': re.compile('ubu.com/(.*?)/').findall(url)[0] 'type': re.compile('ubu.com/(.*?)/').findall(url)[0]
} }
for videourl, title in re.compile('<a href="(http://ubumexico.centro.org.mx/.*?)">(.*?)</a>').findall(data): for videourl, title in re.compile('href="(http://ubumexico.centro.org.mx/.*?)">(.*?)</a>').findall(data):
if videourl.endswith('.srt'): if videourl.endswith('.srt'):
m['srt'] = videourl m['srt'] = videourl
elif not 'video' in m: elif not 'video' in m:
@ -32,6 +32,7 @@ def get_data(url):
m['video'] = m['video'].replace('/video/ ', '/video/').replace(' ', '%20') m['video'] = m['video'].replace('/video/ ', '/video/').replace(' ', '%20')
if m['video'] == 'http://ubumexico.centro.org.mx/video/': if m['video'] == 'http://ubumexico.centro.org.mx/video/':
del m['video'] del m['video']
if not 'title' in m:
m['title'] = strip_tags(decode_html(title)).strip() m['title'] = strip_tags(decode_html(title)).strip()
if not 'url' in m: if not 'url' in m:
print(url, 'missing') print(url, 'missing')