import urllib.request, webbrowser
import xml.etree.ElementTree as et
arr = []
j = 1
k = input('Укажите число сообщений (по умолчанию десять): ')
rss = urllib.request.urlopen('http://l...content-available-to-author-only...a.ru/rss').read().decode()
my_tree = et.fromstring(rss)
print(' ')
print('Lenta.ru : Новости\n')
try:
k = int(k)
except ValueError:
k = 10
for i in my_tree:
for elem in i.findall('item'):
print(('---'*7+' '+ str(j) + ' ' + '---'*7).center(80))
for q in elem.findall('pubDate'):
for i in q.itertext():
print(i)
for q in elem.findall('title'):
for i in q.itertext():
print(i)
for q in elem.findall('description'):
for i in q.itertext():
print(i)
for q in elem.findall('link'):
for i in q.itertext():
print(i)
arr.append(i)
j+=1
if j == k+1:
break
while True:
n = int(input("Введите номер сообщения, чтобы узнать подробности:\n "))
webbrowser.open_new(arr[n-1])
aW1wb3J0IHVybGxpYi5yZXF1ZXN0LCB3ZWJicm93c2VyCmltcG9ydCB4bWwuZXRyZWUuRWxlbWVudFRyZWUgYXMgZXQKYXJyID0gW10KaiA9IDEKayA9IGlucHV0KCfQo9C60LDQttC40YLQtSDRh9C40YHQu9C+INGB0L7QvtCx0YnQtdC90LjQuSAo0L/QviDRg9C80L7Qu9GH0LDQvdC40Y4g0LTQtdGB0Y/RgtGMKTogJykKcnNzID0gdXJsbGliLnJlcXVlc3QudXJsb3BlbignaHR0cDovL2wuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmEucnUvcnNzJykucmVhZCgpLmRlY29kZSgpCm15X3RyZWUgPSBldC5mcm9tc3RyaW5nKHJzcykKcHJpbnQoJyAnKQpwcmludCgnTGVudGEucnUgOiDQndC+0LLQvtGB0YLQuFxuJykKdHJ5OgogICAgICAgIGsgPSBpbnQoaykKZXhjZXB0IFZhbHVlRXJyb3I6CiAgICAgICAgayA9IDEwCmZvciBpIGluIG15X3RyZWU6CiAgICAgICAgZm9yIGVsZW0gaW4gaS5maW5kYWxsKCdpdGVtJyk6CiAgICAgICAgICAgICAgICBwcmludCgoJy0tLScqNysnICcrICBzdHIoaikgKyAnICcgKyAnLS0tJyo3KS5jZW50ZXIoODApKQogICAgICAgICAgICAgICAgZm9yIHEgaW4gZWxlbS5maW5kYWxsKCdwdWJEYXRlJyk6CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciBpIGluIHEuaXRlcnRleHQoKToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludChpKQogICAgICAgICAgICAgICAgZm9yIHEgaW4gZWxlbS5maW5kYWxsKCd0aXRsZScpOgogICAgICAgICAgICAgICAgICAgICAgICBmb3IgaSBpbiBxLml0ZXJ0ZXh0KCk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnQoaSkKICAgICAgICAgICAgICAgIGZvciBxIGluIGVsZW0uZmluZGFsbCgnZGVzY3JpcHRpb24nKToKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIGkgaW4gcS5pdGVydGV4dCgpOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGkpCiAgICAgICAgICAgICAgICBmb3IgcSBpbiBlbGVtLmZpbmRhbGwoJ2xpbmsnKToKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIGkgaW4gcS5pdGVydGV4dCgpOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50KGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyLmFwcGVuZChpKQogICAgICAgICAgICAgICAgais9MQogICAgICAgICAgICAgICAgaWYgaiA9PSBrKzE6CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrCndoaWxlIFRydWU6CiAgICAgICAgbiA9IGludChpbnB1dCgi0JLQstC10LTQuNGC0LUg0L3QvtC80LXRgCDRgdC+0L7QsdGJ0LXQvdC40Y8sINGH0YLQvtCx0Ysg0YPQt9C90LDRgtGMINC/0L7QtNGA0L7QsdC90L7RgdGC0Lg6XG4gIikpIAogICAgICAgIHdlYmJyb3dzZXIub3Blbl9uZXcoYXJyW24tMV0p