def process baseurl http photofile ru page pages links descr count loc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def process():
baseurl = 'http://photofile.ru'
page, pages, links, descr, count, locked, updated = 0, 1, [], [], [], [], []
socket.setdefaulttimeout(timeout)
write('Downloading albums list: 1')
while True:
page += 1
data = download('%s/users/%s/?vid=list&order=%s&page=%d' % (baseurl, user, order, page))
parser = Parser()
parser.parse(data)
parser.close
links += parser.get_hyperlinks()
descr += parser.get_descriptions()
count += parser.get_count()
locked += parser.get_locked()
if page == 1:
pages = parser.get_pages()
if page == pages:
write('\rDownloading albums list: Done (%d pages)\n' % pages)
break
else:
write('\rDownloading albums list: %d of %d' % (page+1, pages))
...