Unverified Commit 7ca38d2f authored by Philipp Winter's avatar Philipp Winter
Browse files

Fetch latest Tor Browser version from JSON.

This fixes <https://bugs.torproject.org/31313>.
parent cfe2a518
......@@ -10,10 +10,13 @@
import os
import sys
import json
import sqlite3
import argparse
from urllib import request
TOR_BROWSER_DOWNLOADS = "https://aus1.torproject.org/torbrowser/update_3/release/downloads.json"
def print_header():
header = """
__ __
......@@ -53,9 +56,13 @@ def main():
args = parser.parse_args()
abs_filename = os.path.abspath(args.filename)
webFile = request.urlopen("https://www.torproject.org/projects/torbrowser/RecommendedTBBVersions/")
versions = webFile.read().decode('utf-8').translate({ord(c): None for c in '[]\n" '})
version = versions.split(",")[-12]
webFile = request.urlopen(TOR_BROWSER_DOWNLOADS)
content = webFile.read()
jsonObj = json.loads(content)
version = jsonObj.get("version", None)
if version is None:
print("Could not fetch version from {}.".format(TOR_BROWSER_DOWNLOADS))
sys.exit(1)
providers = {
"gitlab": "https://gitlab.com/thetorproject/gettorbrowser/raw/releases/",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment