mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
Refactor init_uztracker to be asynchronous for improved performance
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import requests
|
||||
import asyncio
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
global url_uztracker
|
||||
global up
|
||||
url_uztracker = "https://uztracker.net/tracker.php?nm=" # placeholder url for now
|
||||
|
||||
async def init_uztracker():
|
||||
try:
|
||||
response = requests.get(url_uztracker) # get da content from da url
|
||||
soup = BeautifulSoup(response.content, 'html.parser') # create bs object
|
||||
@@ -14,6 +17,8 @@ except requests.exceptions.RequestException as e:
|
||||
print("\nIs the Site down?")
|
||||
up = False
|
||||
|
||||
asyncio.run(init_uztracker())
|
||||
|
||||
def scrape_uztracker(search, debug):
|
||||
if up:
|
||||
search_url = url_uztracker + search
|
||||
|
||||
Reference in New Issue
Block a user