chg: Use cloudscraper to get around cloudflare blocks

This commit is contained in:
Sayantan Santra 2024-04-01 16:52:54 -05:00
parent 336b6470ca
commit 6cbe6454a3
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
2 changed files with 4 additions and 6 deletions

View File

@ -11,8 +11,8 @@ requires-python = ">=3.6"
keywords = ["revanced", "patch"]
license = { file = "LICENSE" }
classifiers = ["Programming Language :: Python :: 3"]
dependencies = ["requests", "packaging", "bs4"]
version = "1.1"
dependencies = ["cloudscraper", "packaging", "bs4"]
version = "1.2"
[project.scripts]
ReVancedBuilder = "ReVancedBuilder:ReVancedBuilder"

View File

@ -8,7 +8,7 @@ import sys
import json
from packaging.version import Version
import requests as req
import cloudscraper as scraper
from bs4 import BeautifulSoup as bs
from ReVancedBuilder.Cleanup import err_exit
@ -99,9 +99,7 @@ def get_apks(appstate):
except req.exceptions.RequestException as e:
err_exit(f"Error fetching patches, {e}", appstate)
session = req.Session()
session.headers.update(
{'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'})
session = scraper.create_scraper()
for app in build_config:
# Check if we need to build an app