This repository was archived by the owner on Jul 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlessonscraper_test.go
More file actions
49 lines (40 loc) · 1.42 KB
/
lessonscraper_test.go
File metadata and controls
49 lines (40 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package insidescraper
import (
"encoding/json"
"fmt"
"testing"
"github.com/gocolly/colly"
)
func TestExtractCompositeLessons(t *testing.T) {
c := colly.NewCollector(
colly.UserAgent("inside-scraper"),
colly.AllowedDomains("insidechassidus.org"),
)
c.OnHTML("tbody tr", func(e *colly.HTMLElement) {
scraper := LessonScraper{
Row: e.DOM,
}
scraper.LoadLesson()
jsonOut, _ := json.MarshalIndent(*scraper.Lesson, "", " ")
fmt.Println(string(jsonOut))
})
fmt.Println("Test1")
//c.Visit("https://insidechassidus.org/maamarim/maamarim-of-the-rebbe/text-based-concise-summary/1553-maamarim-5715")
//fmt.Println("Test2")
c.Visit("https://insidechassidus.org/weekly-parsha/sefer-shemos/209-parshas-shemos/1319-complete-sichos-shmos")
}
// Check that sections which are only lessons are handled right.
func TestScrapeSimpleSection(t *testing.T) {
runScraper("https://insidechassidus.org/jewish-and-chassidic-calendar/shvat/217-15-shvat")
}
func TestScrapeTorasMenachem(t *testing.T) {
runScraper("https://insidechassidus.org/sichos/")
}
// Check output of parsing master page containing many simple sections.
func TestScrapeParentSimpleSection(t *testing.T) {
runScraper("https://insidechassidus.org/thought-and-history/123-kabbala-and-philosophy-series")
}
// Intense PDF course.
func TestPdfCrash(t *testing.T) {
runScraper("https://insidechassidus.org/maamarim/maamarim-of-the-rebbe/text-based-concise-summary")
}