-
-
Save AnderRV/75bb1291af682e1d2678656b5dd1800d to your computer and use it in GitHub Desktop.
This file contains 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
import time | |
import re | |
import random | |
def get_html(url): | |
try: | |
page = int(re.search(r'\d+', url).group()) | |
with open('./data/' + str(page) + '.html') as fp: | |
time.sleep(random.randint(1, 10) / 10) | |
return fp.read() | |
except Exception as e: | |
print(e) | |
return '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment