Skip to content

Download presentations and lectures from LMS using Chrome in headless mode

License

Notifications You must be signed in to change notification settings

F33RNI/LMSDownloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏠 LMSDownloader

Download presentations and lectures from LMS

YouTube Bandcamp Spotify SoundCloud


📙 Dependencies

  • Google Chrome
  • Python 3.9 or 3.10
  • Pillow
  • pypdf2
  • beautifulsoup4
  • selenium

❓ Get started

Installing using pip

pip install git+https://github.com/F33RNI/LMSDownloader.git

Usage in terminal

usage: lmsdownloader [-h] -l LOGIN -p PASSWORD -link LINK_TO_DOWNLOAD -path SAVE_TO [--login-link LOGIN_LINK]
                     [--wait-between-pages WAIT_BETWEEN_PAGES] [--link-check-regex LINK_CHECK_REGEX]
                     [--user-agent USER_AGENT] [--window-size WINDOW_SIZE] [--headless] [--no-logging-init]

options:
  -h, --help            show this help message and exit
  -l LOGIN, --login LOGIN
                        LMS account login
  -p PASSWORD, --password PASSWORD
                        LMS account password
  -link LINK_TO_DOWNLOAD, --link-to-download LINK_TO_DOWNLOAD
                        LMS link to download
  -path SAVE_TO, --save-to SAVE_TO
                        Path to the dir where to save downloaded PDF and TXT
  --login-link LOGIN_LINK
                        link to LMS login page
  --wait-between-pages WAIT_BETWEEN_PAGES
                        how long to wait after going to next page
  --link-check-regex LINK_CHECK_REGEX
                        regex expression to check link_to_download (replace to "^" to bypass link check)
  --user-agent USER_AGENT
                        browser's user agent to prevent mobile version
  --window-size WINDOW_SIZE
                        browser's window size
  --headless            specify to open Chrome in headless mode
  --no-logging-init     specify to bypass logging initialization

Usage as python package

from LMSDownloader import LMSDownloader


def main():
    lms_downloader = LMSDownloader.LMSDownloader("your_login@gmail.com",
                                                 "your_strong_password",
                                                 "https://online.mospolytech.ru/mod/scorm/view.php?id=158345",
                                                 headless=False)
    lms_downloader.download("path/to/download")


if __name__ == "__main__":
    main()

LMSDownloader()

Initializes LMSDownloader class (just copies fields)

Params:

  • lms_login – LMS account login
  • lms_password – LMS account password
  • link_to_download – LMS link to download
  • login_link – Link to LMS login page
  • wait_between_pages – How long to wait after going to next page
  • link_check_regex – Regex expression to check link_to_download (replace to "^" to bypass link check)
  • user_agent - Browser's user agent to prevent mobile version
  • window_size - Default browser's window size
  • headless – Set True to open Chrome in headless mode

LMSDownloader.download()

Downloads pages into PDF (and TXT for SCORM book)

Params:

  • save_to_directory – Path to the dir where to save downloaded PDF and TXT

Returns:

  • Paths to downloaded files

✨ Contribution

  • Anyone can contribute! Just create a pull request

🚧 P.S. This project is under development!