Created
November 24, 2016 07:48
-
-
Save tvorogme/4a66e068db4f14820c176ebbb7dd4d7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
from concurrent import futures | |
import pickle | |
site = "http://izvestia.ru/news/" | |
last_publication = 646946 | |
start = 500000 | |
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('izvestya.pck','wb')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment