Skip to content

Instantly share code, notes, and snippets.

@AnderRV

AnderRV/fake.py Secret

Created August 20, 2021 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnderRV/75bb1291af682e1d2678656b5dd1800d to your computer and use it in GitHub Desktop.
Save AnderRV/75bb1291af682e1d2678656b5dd1800d to your computer and use it in GitHub Desktop.
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