Skip to content

Adding show-urls argument to display just the URLs #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions stanford-dl.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ USAGE : stanford-dl -course COURSE_CODE [-type {video|pdf}] [-all] [-lec lecture
--type Specify whether to download videos or pdfs. Defaults to PDF.
--all Download for all lectures
--lec Comma separated list of lectures e.g. 1,3,5,10
--show-urls Show the URLs only. Do not start Downloads
--help Display this help message and quit

Found a bug? Feel free to raise an issue on https://github.com/coderick14/stanford-dl
Expand Down Expand Up @@ -136,6 +137,7 @@ func main() {
typeFlag = flag.String("type", "pdf", "[video | pdf]. Defaults to pdf.")
all = flag.Bool("all", false, "Download material for all lectures for the given course")
lectures = flag.String("lec", "", "Specify comma separated list of lectures e.g 1,3,10")
showURLs = flag.Bool("show-urls", false, "Show the URLs only. Do not start Downloads. ")
siteBaseURL = "https://see.stanford.edu"
courseBaseURL = "https://see.stanford.edu/Course/"
videoBaseURL = "http://html5.stanford.edu/videos/courses/see/"
Expand Down Expand Up @@ -226,9 +228,14 @@ func main() {

fileName := fmt.Sprintf("%s-lecture%02d.%s", *courseName, lectureList[i], extension)

// fetch lecture concurrently
wg.Add(1)
go downloadLecture(i, url, fileName, &wg)
if *showURLs == true {
// Output the URLs only
fmt.Println(url)
} else {
// fetch lecture concurrently
wg.Add(1)
go downloadLecture(i, url, fileName, &wg)
}
}

// Wait for all lectures to be downloaded
Expand Down