📜 ⬆️ ⬇️

Count the votes yourself

Count the votes yourself.



So, for a number of reasons, I follow the elections in Ukraine.
And then an interesting idea came to my mind - but let's count the voices yourself?

For starters - cvk.gov.ua/vp2010/wp335pt001f01=701.html you can get a list of all cities
If you open the city page (for example, cvk.gov.ua/vp2010/wp336pt001f01=701pt005f01=1.html ) then there is a table of all departments and specific numbers for them.

Total plan:

')
Drove ?:

#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  1. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  2. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  3. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  4. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  5. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  6. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  7. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  8. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  9. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  10. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  11. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  12. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  13. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  14. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  15. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  16. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  17. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  18. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  19. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  20. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  21. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  22. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  23. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  24. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  25. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  26. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  27. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  28. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  29. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  30. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  31. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  32. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  33. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  34. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  35. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  36. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  37. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  38. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
  39. #! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .
#! /usr/bin/python from urllib import urlopen import re import os import os.path def getUrl(url): print "get url - " + url if os.path.exists( "/home/user/cwk/" + url): print "file from cache" text = open( "/home/user/cwk/" + url, 'r' ).read() return text print "Load url first time" proxies = { 'http' : 'http://localhost:3128' } text = urlopen( "http://cvk.gov.ua/vp2010/" + url, proxies=proxies).read() f = open( "/home/user/cwk/" + url, 'w' ) f.write(text) f.close() return text #Get the request id key text = getUrl( 'wp335pt001f01=701.html' ) #print text links = re.findall( "class=a1\\s*href=\"([^\"]+)\"" , text, re.IGNORECASE or re.MULTILINE) #links now contains all the links to get totalData = [0, 0, 0, 0, 0] for link in links: print link text = getUrl(link) tableData = re.findall( "\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)\\s*<td class=td2small align=center>(\\d+)" , text, re.IGNORECASE or re.MULTILINE) for data in tableData: totalData[0] += int (data[0]) totalData[1] += int (data[1]) totalData[2] += int (data[2]) totalData[3] += int (data[3]) totalData[4] += int (data[4]) print "Total votes count - " + str(totalData[0]) print "Invalid votes count - " +str(totalData[1]) + " (" + str( float (totalData[1]) / float (totalData[0])) + "%)" print "Support Tymoshenko - " +str(totalData[2]) + " (" + str( float (totalData[2]) / float (totalData[0])) + "%)" print "Support Yanukovych - " +str(totalData[3]) + " (" + str( float (totalData[3]) / float (totalData[0])) + "%)" print "Against all - " +str(totalData[4]) + " (" + str( float (totalData[4]) / float (totalData[0])) + "%)" * This source code was highlighted with Source Code Highlighter .


Run:

Total votes count - 25402069
Invalid votes count - 304811 (0.0119994556349%)
Support Tymoshenko - 11577320 (0.455762875063%)
Support Yanukovych - 12410894 (0.488578076061%)
Against all - 1109033 (0.0436591602046%)


For every paranoid there is something to do.

PS:% habrauser% before starting, do not forget to change the path to “home dir” (substitution "~ /" gives an error ...) and create a folder "cwk" there

Source: https://habr.com/ru/post/83635/


All Articles