Skip to content

Instantly share code, notes, and snippets.

@tvorogme
Created November 20, 2016 23:28
Show Gist options
  • Save tvorogme/eafbd6d459eda0838d3f87942eba1a76 to your computer and use it in GitHub Desktop.
Save tvorogme/eafbd6d459eda0838d3f87942eba1a76 to your computer and use it in GitHub Desktop.
from urllib.request import urlopen
from concurrent import futures
import pickle
site = "http://www.nnov.kp.ru/daily/1/"
last_publication = 3625745
start = 3527000
answer = []
def get_page(n):
api_html = urlopen(site+str(n)).read().decode()
answer.append(api_html)
print('\r', len(answer), end="")
with futures.ThreadPoolExecutor(50) as executor:
executor.map(get_page, range(start, last_publication))
pickle.dump(answer, open('users.pck','wb'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment