Create webscraping.py

a simple webscraping script in python. My knowledge of python is limited. I would appreciate if someone could help me reduce the complexity of this algorithm. Right now, it is "quadratic". Something sublinear or linear would be fine. Or someone could help me find a way to periodically change proxies after maybe 1000 reads to prevent the scraped website to stop the connexion.
Thanks in advance