Browse Source

Update 'pluralsight.py'

master
parent
commit
feca5467b6
1 changed files with 11 additions and 5 deletions
  1. 11
    5
      pluralsight.py

+ 11
- 5
pluralsight.py View File

@@ -30,7 +30,7 @@ HIDE_SELENIUM_INSTANCES = False
SELENIUM_TIMEOUT_IN_SECONDS = 30

# Maximum parallel course download count
MAX_PARALLEL_COURSE_DOWNLOAD_COUNT = 3
MAX_PARALLEL_COURSE_DOWNLOAD_COUNT = 1

# Maximum number of retry count for downloads
DOWNLOAD_RETRY_COUNT = 100
@@ -38,6 +38,9 @@ DOWNLOAD_RETRY_COUNT = 100
# Maximum number of account registrations allowed per IP
MAX_ACCOUNT_PER_IP = 5

# True/False to determine whether consecutive video downloading should have delays in between
IS_DELAY_BETWEEN_VIDEO = True

# Minimum number of seconds to wait between consecutive video downloads
MIN_VIDEO_DOWNLOAD_DELAY = 10

@@ -72,12 +75,15 @@ DOWNLOADED_COURSES_FILE_LOCATION = os.path.join(MASTER_DIRECTORY, "downloaded.tx
ydl_options = {
'writesubtitles': True,
'nooverwrites': True,
'sleep_interval': MIN_VIDEO_DOWNLOAD_DELAY,
'max_sleep_interval': MAX_VIDEO_DOWNLOAD_DELAY,
'retries': 100,
'download_archive': ARCHIVE_FILE_PATH
}

if IS_DELAY_BETWEEN_VIDEO:
ydl_options['sleep_interval'] = MIN_VIDEO_DOWNLOAD_DELAY
ydl_options['max_sleep_interval'] = MAX_VIDEO_DOWNLOAD_DELAY


# endregion


@@ -306,9 +312,9 @@ def get_paths_and_independent_courses(paths_file: str, courses_file: str) -> Tup
pluralsight_paths_list = [PluralsightPath(**paths_dict) for paths_dict in pluralsight_paths_dicts_list]

if courses_file.startswith("http"):
courses_list_string = requests.get(paths_file).text
courses_list_string = requests.get(courses_file).text
else:
courses_list_string = Path(paths_file).read_text()
courses_list_string = Path(courses_file).read_text()

courses_list = list(filter(None, courses_list_string.split('\n')))


Loading…
Cancel
Save