I have come across here вконтакте interesting enough group: ”the Soviet psychodelic animated cartoons”) well and since at me анлим also it is necessary to swing something, has decided to rock all cartoon films from group)) has actually started to think as it to make, eat online services, also there is a plug-in for Firefox and userjs for Opera, but there is one big but in any of these ways it is necessary to swing on one file, and besides ручами to come to copy and т.д, etc.,
Like there is any software under Windows, but a horse-radish with it, under линукс for couples даж didn't begin to search. All прелесь in programming: if there is no gentle to you a software, write) Wanted to write in the beginning a script on bash’е, but has then changed the mind and has decided to write on python. Actually here that has turned out: если нет нежного тебе софта, напиши) Хотел в начале написать скрипт на bash’е, но потом передумал и решил написать на python. Собственно вот, что получилось:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | # - * - coding: utf8 - * - import httplib import re import os #param url = ' a link to the list from video' email = ' soap' id = ' айди' hash = ' хэш the password' # def pb_str (prc, ch, width): ch, width) : return ch * int ((prc * width) / 100)(prc * width) / 100) plinks = re.compile (' <div class = "aname"> <a href = "(VIDEO - [0-9] * _ [0-9] *)"> ')('<div class="aname"><a href="(video-[0-9]*_[0-9]*)">') phost = re.compile (' http:// (. *)/assets/videos / [a-f0-9] *\.vk.flv ')('http://(.*)/assets/videos/[a-f0-9]*\.vk.flv') pvtag = re.compile (' so\.addVariable \(\'vtag \', \' (. *?) \' \); ')('so\.addVariable\(\'vtag\',\'(.*?)\'\);') pvkid = re.compile (' so\.addVariable \(\'vkid \', \' (. *?) \' \); ')('so\.addVariable\(\'vkid\',\'(.*?)\'\);') pname = re.compile (' <h1>. * AND raquo; (. *) </h1> ')('<h1>.*» (.*)</h1>') width = 60 print ' Downloading of the list of video files...' conn = httplib. HTTP (' vkontakte.ru ')HTTP('vkontakte.ru') conn.putrequest (' GET ', url), url) conn.putheader (' Host ', ' vkontakte.ru '), 'vkontakte.ru') conn.putheader (' Cookie ', ' remixemail = ' + email + '; remixmid = ' + id + '; remixpass = ' + hash), 'remixemail='+email+';remixmid='+id+';remixpass='+hash) conn.endheaders () conn.getreply () content = conn.getfile ().read ()).read() conn.close () all = plinks.findall (content)(content) print ' It is ready' print str (len (all)) + ' files for races'len(all))+' файлов для скачки' count = 0 for i in all:: count + = 1 conn.connect (' vkontakte.ru ', 80),80) conn.putrequest (' GET ', ' http://vkontakte.ru/ ' +i), 'http://vkontakte.ru/'+i) conn.putheader (' Host ', ' vkontakte.ru '), 'vkontakte.ru') conn.putheader (' Cookie ', ' remixemail = ' + email + '; remixmid = ' + id + '; remixpass = ' + hash), 'remixemail='+email+';remixmid='+id+';remixpass='+hash) conn.endheaders () conn.getreply () content = conn.getfile ().read ()).read() conn.close () vtag = pvtag.search (content).group (1)content).group(1) vkid = pvkid.search (content).group (1)content).group(1) name = unicode (pname.search (content).group (1), ' cp1251 ')pname.search(content).group(1), 'cp1251') print str (count) + ': ' +namecount)+' : '+name filename = name + '.flv' conn.connect (' vkadre.ru ', 80),80) conn.putrequest (' GET ', ' http://vkadre.ru/get_video?vkid= ' +vkid + ' AND vtag = ' + vtag), 'http://vkadre.ru/get_video?vkid='+vkid+'&vtag='+vtag) conn.putheader (' Host ', ' vkadre.ru '), 'vkadre.ru') conn.endheaders () link = conn.getreply () [2] [' Location '])[2]['Location'] host = phost.search (link).group (1)link).group(1) conn.close () if os.path.isfile (filename):.isfile(filename): fstat = os.stat (filename)(filename) conn.connect (host, 80)80) conn.putrequest (' GET ', link), link) conn.putheader (' Host ', host), host) conn.endheaders () size = conn.getreply () [2] [' Content-Length '])[2]['Content-Length'] conn.close () if fstat.st_size <int (size): int(size): conn.connect (host, 80)80) conn.putrequest (' GET ', link), link) conn.putheader (' Host ', host), host) conn.putheader (' Range ', ' bytes = ' + str (fstat.st_size) + ' - '), 'bytes='+str(fstat.st_size)+'-') conn.endheaders () conn.getreply () flv_file = open (filename, ' ab ')filename, 'ab') src_flv = conn.getfile ()) get = fstat.st_size while True: kb = src_flv.read (1024)1024) get + = 1024 if not kb: break flv_file.write (kb) perc = round (get / (float (size)) *100,3)get/(float(size))*100,3) if perc> 100:: perc = 100.0 print '\r ' + str (perc).rjust (7) + ' % [' + \ + str(perc).rjust(7) + '% [' + \ pb_str (perc, ' * ', width).ljust (width, ' ') + '] ',, width).ljust(width, ' ') + ']', flv_file.close () conn.close () print ' Ok' else: print ' Ok' else: conn.connect (host, 80)80) conn.putrequest (' GET ', link), link) conn.putheader (' Host ', host), host) conn.endheaders () size = conn.getreply () [2] [' Content-Length '])[2]['Content-Length'] flv_file = open (filename, ' wb ')filename, 'wb') src_flv = conn.getfile ()) get = 0 while True: kb = src_flv.read (1024)1024) get + = 1024 if not kb: break flv_file.write (kb) perc = round (get / (float (size)) *100,3)get/(float(size))*100,3) print '\r ' + str (perc).rjust (7) + ' % [' + \ + str(perc).rjust(7) + '% [' + \ pb_str (perc, ' * ', width).ljust (width, ' ') + '] ',, width).ljust(width, ' ') + ']', flv_file.close () conn.close () print ' Ok' print ' All files are downloaded' |
Собстенно the scratch pulls a page with video list pulls out, links on them and downloads on one name of a file undertakes from video name. Since speed анлима at me not all that well and нат on фряхе I yet haven't adjusted an Internet in a consequence of that it is necessary to chop off sometimes on a laptop, in a scratch have added possibility докачки a file. I.e. after start it checks if the file with such name already exists also its size less necessary that докачивает иначае passes to a following file. In Windows most likely there will be problems with codings, but me somehow while пофиг, to pass to Windows I do not gather) Т.е. после запуска он проверяет если файл с таким именем уже существует и его размер меньше необходимого то докачивает иначае переходит к следующему файлу. В винде скорее всего будут проблемы с кодировками, но мне как-то пока пофиг, переходить на винду не собираюсь)
Newer version of a script lies here









Pingback: Вконтакте.ру «a blog sphere Echo
Pingback: medicinal herbal tea
Pingback: reverse mortgages for seniors
Pingback: air purifiers home
Pingback: debt relief company
Pingback: debt consolidation companies
Pingback: debt negotiation
Pingback: debt relief company
Pingback: debt settlement company
Pingback: video editing
Pingback: debt relief company
Pingback: debt consolidation companies
Pingback: debt relief company
Pingback: debt relief company