javascript - How to make a page loop script -
is there can make script download multiple pages, instead of 1 single page?
this script in python:
import json, urllib page_data = urllib.urlopen("http://example.com/wp-content/themes/example/html5system/request/example-8/get/1/").read() js = json.loads(page_data) #print js['page'] open('page1.svg', 'wb') f_out: f_out.write(js['page'].encode('utf-8'))
import json, urllib in range(1,301): # loop 1 300 page_data = urllib.urlopen("http://example.com/wp-content/themes/example/html5system/request/example-8/get/%d/" % i).read() js = json.loads(page_data) open('page%d.svg' % i, 'wb') f_out: # save each page in separate svg f_out.write(js['page'].encode('utf-8')) f_out.close()
i added simple loop around existing code runs numbers 1 300. did string replacement '%d' % i
inserts value of i
%d
located in string. did same thing file name, each page saved separate .svg file.
Comments
Post a Comment