Skip to content

Commit

Permalink
fixed takanimelist link, fixed #35
Browse files Browse the repository at this point in the history
  • Loading branch information
deven96 committed Sep 23, 2020
1 parent 015a3c9 commit c1a1ca0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
2 changes: 2 additions & 0 deletions engine/engines.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ type Movie struct {
Source string // The Engine From which it is gotten from
SubtitleLink *url.URL // single subtitle link
SubtitleLinks map[string]*url.URL // Subtitle links for a series
ImdbLink string // imdb link if available
Tags string // csv of words that are linked to the movie if available
}

// MovieJSON : JSON structure of all downloadable movies
Expand Down
16 changes: 15 additions & 1 deletion engine/fzmovies.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,21 @@ func (engine *FzEngine) parseSingleMovie(el *colly.HTMLElement, index int) (Movi
}
movie.Title = strings.TrimSuffix(strings.TrimSpace(el.ChildText("b")), "<more>")
if len(el.ChildTexts("small")) > 3 {
movie.Description = strings.TrimSpace(el.ChildTexts("small")[3])
description := strings.TrimSpace(el.ChildTexts("small")[3])
tagsRe := regexp.MustCompile(`Tags\s+: (.*)\.\.\..*`)
descAndOthers := tagsRe.Split(description, -1)

if len(descAndOthers) > 0 {
movie.Description = strings.TrimSuffix(descAndOthers[0], "<more>")
tag := tagsRe.FindStringSubmatch(description)

if len(tag) > 1 {
movie.Tags = strings.ReplaceAll(tag[1], "|", ",")
}
} else {
movie.Description = description
}

}
downloadLink, err := url.Parse(el.Request.AbsoluteURL(el.ChildAttr("a", "href")))

Expand Down
26 changes: 25 additions & 1 deletion engine/netnaija.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,31 @@ func (engine *NetNaijaEngine) updateDownloadProps(downloadCollector *colly.Colle
movie := &((*movies)[movieIndex])
description := e.ChildText("p")
if description != "" {
movie.Description = description
extraRe := regexp.MustCompile(`Genre: `)
descAndOthers := extraRe.Split(description, -1)

if len(descAndOthers) > 0 {
movie.Description = descAndOthers[0]
}

if len(descAndOthers) > 1 {
others := descAndOthers[1]
categoryRe := regexp.MustCompile(`^(.*)Release Date:`)
starsRe := regexp.MustCompile(`Stars:(.*)Source:`)
imdbRe := regexp.MustCompile(`.*(https:\/\/www\.imdb.*)`)
categories := categoryRe.FindStringSubmatch(others)
stars := starsRe.FindStringSubmatch(others)
imdb := imdbRe.FindStringSubmatch(others)
if len(categories) > 1 {
movie.Category = categories[1]
}
if len(stars) > 1 {
movie.Cast = stars[1]
}
if len(imdb) > 1 {
movie.ImdbLink = imdb[1]
}
}
}
if !(strings.HasSuffix(movie.DownloadLink.String(), "/download") || strings.HasSuffix(movie.DownloadLink.String(), "?d=1")) {
downloadLink, err := url.Parse(path.Join(movie.DownloadLink.String(), "download"))
Expand Down
2 changes: 1 addition & 1 deletion engine/takanimelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type TakanimeList struct {

// NewTakanimeListEngine : create a new engine for scraping latest anime from chia-anime
func NewTakanimeListEngine() *TakanimeList {
base := "https://takanimelist.best"
base := "https://takanimelist.live"
baseURL, err := url.Parse(base)
if err != nil {
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion reference/Gophie.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ info:
### Anime
- [AnimeOut](https://www.animeout.xyz)
- [TakanimeList] (https://takanimelist.best)
- [TakanimeList] (https://takanimelist.live)
### Korean
Expand Down

0 comments on commit c1a1ca0

Please sign in to comment.