Answer the question
In order to leave comments, you need to log in
How to parse information from 511756 API pages as quickly as possible?
I need to create a database, from each page I pull out approximately a maximum of 50 characters in total.
Example:
import threading
import time
def parsep(ar1, ar2):
for i in range(10000000+ar1, 10000000+ar2):
try:
url = "http://api.kakoeto?type=user&id=" + str(i)
data_json = urlopen(url)
except:
time.sleep(1)
url = "http://api.kakoeto?type=user&id=" + str(i)
data_json = urlopen(url)
d = json.loads(data_json.read().decode("utf-8"))
if d['status'] == 'ok':
dbCharacter(name=d['name'], id=d['id']).save()
o1 = threading.Thread(target=parsep(0, 3600), name="o1")
Answer the question
In order to leave comments, you need to log in
Write a script in two lines for scrapy and don’t worry about how many streams it will download into (he knows how to determine it himself)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question