Skip to content

Commit

Permalink
fix: use class to locate frame (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanaden authored Jan 24, 2024
1 parent 0fbf415 commit 0154e04
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions internal/pkg/canvas/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ func (c *CanvasClient) extractVideoAudioUrlFromFolder(page playwright.Page, fold
}

func (c *CanvasClient) extractCurrentVideoFolder(page playwright.Page, folderPath string, increment func(isFile bool)) *CourseVideoFolder {
frameLoc := page.FrameLocator("#tool_content")
frameLoc := page.FrameLocator(".tool_launch")
currentVideos := []*CourseVideoFile{}
currentFolders := []*CourseVideoFolder{}

Expand All @@ -639,9 +639,9 @@ func (c *CanvasClient) extractCurrentVideoFolder(page playwright.Page, folderPat
if err != nil {
pterm.Error.Printfln("error finding videos in %s", folderPath)
}
if len(videoLocs) == 0 {
pterm.Info.Printfln("found 0 videos in %s", folderPath)
}
// if len(videoLocs) == 0 {
// pterm.Info.Printfln("found 0 videos in %s", folderPath)
// }
if len(videoLocs) > 0 {
for _, videoLoc := range videoLocs {
videoUrlLoc := videoLoc.GetByRole("link").First()
Expand Down Expand Up @@ -682,7 +682,7 @@ func (c *CanvasClient) extractCurrentVideoFolder(page playwright.Page, folderPat
folderListLoc.WaitFor()
folderLocs, err := folderListLoc.Locator(".subfolder-item").All()
if err != nil {
pterm.Error.Printfln("err getting .subfolder-item")
pterm.Error.Printfln("err getting .subfolder-item: %s", err)
} else {
// fmt.Printf("\nfound %d folder locs", len(folderLocs))
if len(folderLocs) > 0 {
Expand Down Expand Up @@ -755,6 +755,7 @@ func (c *CanvasClient) GetCourseVideos(page playwright.Page, dataDir string, cou

courseVideosPath := filepath.Join(dataDir, course.CourseCode, "videos")
courseFolder := c.extractCurrentVideoFolder(page, courseVideosPath, increment)
fmt.Printf("\ncourse folders: %v", courseFolder.Folders)
for _, fold := range courseFolder.Folders {
c.extractVideoAudioUrlFromFolder(page, fold, increment)
}
Expand Down

0 comments on commit 0154e04

Please sign in to comment.