//go get github.com/PuerkitoBio/goquery
package main

import (
    "fmt"
    "github.com/PuerkitoBio/goquery"
    "regexp"
    "sync"
    "log"
)

func main() {
    url := "https://13dl.me/list/popular/"

    var count int = 0

    var mu sync.Mutex
    message := make(chan string)

    for {

        var ta_url string
        ta_url = url

        go func(){

            doc, err := goquery.NewDocument(ta_url)
            if err != nil {
                log.Println("err",err)
            }

            atag := doc.Find("a")
            re1 := regexp.MustCompile(`^Home`)
            re2 := regexp.MustCompile(`^Popular Manga`)
            re3 := regexp.MustCompile(`^Page\s\d*`)
            re4 := regexp.MustCompile(`^Prev`)
            re5 := regexp.MustCompile(`^Newest`)
            re0 := regexp.MustCompile(`^Next`)

            var title string
            var flag bool

            atag.Each(func(i int, s *goquery.Selection){
                str1, _ := s.Attr("title")
                str2, _ := s.Attr("href")
                title = str1
                if re0.MatchString(title) == true {
                    message <- str2
                    flag = true
                } else if ( title == "" || re1.MatchString(title) == true || re2.MatchString(title) == true || re3.MatchString(title) == true || re4.MatchString(title) == true || re4.MatchString(title) == true || re5.MatchString(title) == true ) {
                } else {
                   mu.Lock()
                    count ++
//                  fmt.Println(count, title)
                   mu.Unlock()
                }
            })
            atag = nil
            doc = nil
            if flag != true {
                message <- ""
            }
        }()

        msg := <-message
        fmt.Println(count,msg)
        if msg != "" {
            url = msg
        } else {
            break
        }
    }
}
Edit
Pub: 16 May 2022 01:59 UTC
Views: 236