forked from lambdamai/parser
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparser_.py
More file actions
20 lines (16 loc) · 771 Bytes
/
Copy pathparser_.py
File metadata and controls
20 lines (16 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*-
from params_ import *
def save_file(topsites):
with open("out.txt", "w", encoding="utf-8") as f:
for site in topsites:
f.write(u'\nТоп 100 книг по версии сайта %s:\n\n' % (site.name))
top = site.get_top()
for i in range(len(top[0])):
try:
f.write(u'%d) %s - %s\n' % (i + 1, top[0][i].text, top[1][i].text))
except AttributeError:
f.write(u'%d) %s - Неизвестный автор\n' % (i + 1,top[0][i].text))
livelib = LiveLib('http://www.livelib.ru/books/top')
readrate = ReadRate('http://readrate.com/rus/ratings/top100')
libs = Libs('http://libs.ru/best-100')
save_file([livelib, readrate, libs])