improved function to connect to the internet
This commit is contained in:
@@ -14,6 +14,7 @@ class ProxAttribute(ListAttribute):
|
||||
'ftp': value
|
||||
}
|
||||
|
||||
|
||||
class UrlListAttribute(ListAttribute):
|
||||
def validate(self, value: str):
|
||||
v = value.strip()
|
||||
@@ -24,10 +25,9 @@ class UrlListAttribute(ListAttribute):
|
||||
setting_value=v,
|
||||
rule="has to be a valid url"
|
||||
)
|
||||
|
||||
|
||||
def single_object_from_element(self, value: str):
|
||||
return urlparse(value)
|
||||
|
||||
|
||||
|
||||
class ConnectionSection(Section):
|
||||
@@ -62,7 +62,7 @@ class ConnectionSection(Section):
|
||||
"all the error messages are shown.",
|
||||
value="0.3"
|
||||
)
|
||||
|
||||
|
||||
# INVIDIOUS INSTANCES LIST
|
||||
self.INVIDIOUS_INSTANCE_LIST = UrlListAttribute(
|
||||
name="invidious_instances",
|
||||
@@ -80,6 +80,8 @@ class ConnectionSection(Section):
|
||||
# INVIDIOUS PROXY
|
||||
self.INVIDIOUS_PROXY_VIDEOS = BoolAttribute(
|
||||
name="invidious_proxy_video",
|
||||
value="false",
|
||||
description="Downloads the videos using the given instances."
|
||||
)
|
||||
|
||||
self.attribute_list = [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
import random
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple, Set
|
||||
from typing import List, Tuple, Set, Dict
|
||||
|
||||
from .path_manager import LOCATIONS
|
||||
from .config import LOGGING_SECTION, AUDIO_SECTION, CONNECTION_SECTION, MISC_SECTION, PATHS_SECTION
|
||||
@@ -77,6 +77,7 @@ DEFAULT_VALUES = {
|
||||
}
|
||||
|
||||
TOR: bool = CONNECTION_SECTION.USE_TOR.object_from_value
|
||||
PROXIES_LIST: List[Dict[str, str]] = CONNECTION_SECTION.PROXIES.object_from_value
|
||||
proxies = {}
|
||||
if len(CONNECTION_SECTION.PROXIES) > 0:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user