Initial work into optional settings

Moved proxitok_instance to OPTIONS
Signed-off-by: nanometer5088 <code.deleo@simplelogin.com>
This commit is contained in:
nanometer5088
2023-06-20 18:52:24 -03:00
parent 93620c11f2
commit 1754e1f377
3 changed files with 13 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ def streamuser(username):
def proxitok_scraper(username: str) -> list[str]:
from src.constants import APP
from src.constants import OPTIONS
log("Scraper started")
print("\nObtaining URLs - this can take a while with users with many posts.")
session = requests.Session()
@@ -27,7 +27,7 @@ def proxitok_scraper(username: str) -> list[str]:
next_href = ""
rate_limit = 0
while True:
url = f"{APP['proxitok_instance']}/@{username}{next_href}"
url = f"{OPTIONS['proxitok_instance']}/@{username}{next_href}"
response = session.get(url)
log(f"Scraping {url}")

View File

@@ -1,5 +1,11 @@
# Do not change anything here
APP = {
"name": "CLI TikTok",
"proxitok_instance": "https://proxitok.pabloferreiro.es",
"version": 0.80
"version": 0.81
}
# Here are the app settings. You are free to configure this field
OPTIONS = {
"proxitok_instance": "https://proxitok.pabloferreiro.es"
}

View File

@@ -22,7 +22,7 @@ def streamtrending(amount:int = 24):
def proxitok_trending(amount: int = 24) -> list[str]:
from src.constants import APP
from src.constants import OPTIONS
log("Scraper started")
print("\nObtaining URLs - this can take a while when requesting many posts.")
session = requests.Session()
@@ -31,8 +31,8 @@ def proxitok_trending(amount: int = 24) -> list[str]:
rate_limit = 0
while True:
# The "next" page url is always the same but loads different trending videos each time
url = f"{APP['proxitok_instance']}/trending{next_href}"
# url = f"https://proxitok.pussthecat.org/trending{next_href}"
url = f"{OPTIONS['proxitok_instance']}/trending{next_href}"
response = session.get(url)
log(f"Scraping {url}")