Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Tor_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import platform
import os


from bs4 import BeautifulSoup


def check_tor_installed():
Expand All @@ -15,7 +15,7 @@ def check_tor_installed():

def install_tor_windows():
# Download Tor browser bundle for Windows
download_url = "https://www.torproject.org/dist/torbrowser/10.5.2/torbrowser-install-10.5.2_en-US.exe"
download_url = get_latest_version_link()
response = requests.get(download_url)
tor_installer_path = "torbrowser-install.exe"

Expand Down Expand Up @@ -44,6 +44,22 @@ def install_tor():
install_tor_linux()
elif platform.system() == 'Darwin':
install_tor_macos()

def get_latest_version_link():
url = 'https://www.torproject.org/download/'
response = requests.get(url)
soup = BeautifulSoup(response.content, features="html.parser")
link = soup.find('a', attrs={'class': 'downloadLink'}, string="Download for Windows")

if link is not None:
href = link.get('href')
return create_download_link(href)
else:
print('Cant get a valid windows download link from https://www.torproject.org/download/')
exit()

def create_download_link(href):
return 'https://www.torproject.org' + href



1 change: 1 addition & 0 deletions requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
uvicorn
rich
pyngrok
beautifulsoup4