1

Fix downloading of forums with many pages

This commit is contained in:
2021-12-20 17:45:05 +04:00
parent 2de559f5cb
commit 21d9108539
5 changed files with 48 additions and 21 deletions

View File

@@ -91,17 +91,6 @@ func getLastModeratedDate(querier *goquery.Document) string {
return dateValue.Format("2006-01-02")
}
func getNavigation(querier *goquery.Document) {
querier.Find("td[align=right] .nav a").Each(func(i int, sel *goquery.Selection) {
if !strings.Contains(sel.Text(), "След") {
href, _ := sel.Attr("href")
forumPagesLinks[sel.Text()] = href
}
})
dlog.Info().Int("количество страниц", len(forumPagesLinks)+1).Msg("Определено количество страниц")
}
func getTopics(querier *goquery.Document) {
querier.Find(".forumline tr").Each(func(i int, sel *goquery.Selection) {
if strings.Contains(sel.Text(), "DL:") {
@@ -119,3 +108,15 @@ func getTopics(querier *goquery.Document) {
}
})
}
func isForumPageEmpty(querier *goquery.Document) bool {
isEmpty := false
querier.Find(".forumline tr").Each(func(i int, sel *goquery.Selection) {
if strings.Contains(sel.Text(), "В этом форуме пока нет сообщений") {
isEmpty = true
}
})
return isEmpty
}