asurascans

package
v0.0.0-...-24eef8c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = &generic.Configuration{
	Name:                 "AsuraScans",
	Delay:                50 * time.Millisecond,
	Parallelism:          15,
	ReverseChapters:      true,
	NeedsHeadlessBrowser: true,
	BaseURL:              "https://asuracomic.net/",
	GenerateSearchURL: func(baseUrl string, query string) string {
		query = strings.ReplaceAll(query, "’s", "")
		query = strings.ReplaceAll(query, "'s", "")
		query = strings.ReplaceAll(query, "’ll", "")
		query = strings.ReplaceAll(query, "'ll", "")
		return baseUrl + "series?page=1&name=" + query
	},
	MangaExtractor: &generic.MangaExtractor{
		Selector: ".grid > a",
		Name: func(selection *goquery.Selection) string {
			return strings.TrimSpace(selection.Find("div:nth-of-type(2) > span:nth-of-type(1)").Text())
		},
		URL: func(selection *goquery.Selection) string {
			return selection.AttrOr("href", "")
		},
		Cover: func(selection *goquery.Selection) string {
			return selection.Find("img").AttrOr("src", "")
		},
	},
	ChapterExtractor: &generic.ChapterExtractor{
		Selector: "div.pl-4.py-2.border.rounded-md.group.w-full",
		Name: func(selection *goquery.Selection) string {
			name := selection.Find("h3:nth-of-type(1)").Text()
			return name
		},
		URL: func(selection *goquery.Selection) string {
			return selection.Find("a").AttrOr("href", "")
		},
		Volume: func(selection *goquery.Selection) string {
			name := selection.Find("h3:nth-of-type(1)").Text()
			if strings.HasPrefix(name, "Vol.") {
				splitted := strings.Split(name, " ")
				return splitted[0]
			}
			return ""
		},
		Date: func(selection *goquery.Selection) *time.Time {
			date := selection.Find("h3:nth-of-type(2)").Text()
			t, err := dateparse.ParseAny(date)
			if err != nil {
				return nil
			}
			return &t
		},
	},
	PageExtractor: &generic.PageExtractor{
		Selector: "div.w-full > img.mx-auto",
		URL: func(selection *goquery.Selection) string {
			return selection.AttrOr("src", "")
		},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL