summaryrefslogtreecommitdiff
path: root/scripts/visit_site.py
blob: 90a56ecf9e873c26fb196a2ca8665b62e7c47af5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python3

from bs4 import BeautifulSoup
import requests
import sys


def main(url):
    if not url.startswith("http"):
        url = "http://" + url
    if not url.endswith("/"):
        url += "/"
    response = requests.get(url)
    soup = BeautifulSoup(response.text, "html.parser")
    for link in soup.find_all("a", "link-browse"):
        href = link["href"]
        try:
            requests.get(url + href)
        except Exception:
            pass


if __name__ == '__main__':
    sys.path.append(".")
    from pergamon.settings.local import BASE_URL as url
    main(url)