aboutsummaryrefslogtreecommitdiff
path: root/tools/charcrawler
diff options
context:
space:
mode:
Diffstat (limited to 'tools/charcrawler')
-rw-r--r--tools/charcrawler/crawler/acd.go3
-rw-r--r--tools/charcrawler/crawler/acd_anime.go3
-rw-r--r--tools/charcrawler/crawler/crawler.go1
3 files changed, 7 insertions, 0 deletions
diff --git a/tools/charcrawler/crawler/acd.go b/tools/charcrawler/crawler/acd.go
index 31efb0d..9a37b95 100644
--- a/tools/charcrawler/crawler/acd.go
+++ b/tools/charcrawler/crawler/acd.go
@@ -25,6 +25,9 @@ func (a ACDCrawler) Crawl(id int) (CharacterData, error) {
25 if strings.Contains(text, "bad character : try") { 25 if strings.Contains(text, "bad character : try") {
26 return nil, CharacterNotFound 26 return nil, CharacterNotFound
27 } 27 }
28 if strings.Contains(text, "Your IP has been blocked") {
29 return nil, Banned
30 }
28 dataTr := doc.Find("#besttable").Next().ChildrenFiltered("tbody").ChildrenFiltered("tr") 31 dataTr := doc.Find("#besttable").Next().ChildrenFiltered("tbody").ChildrenFiltered("tr")
29 leftSide := dataTr.Children().Eq(0) 32 leftSide := dataTr.Children().Eq(0)
30 rightSide := dataTr.Children().Eq(1) 33 rightSide := dataTr.Children().Eq(1)
diff --git a/tools/charcrawler/crawler/acd_anime.go b/tools/charcrawler/crawler/acd_anime.go
index 106655d..c697b43 100644
--- a/tools/charcrawler/crawler/acd_anime.go
+++ b/tools/charcrawler/crawler/acd_anime.go
@@ -25,6 +25,9 @@ func (a ACDAnimeCrawler) Crawl(id int) (CharacterData, error) {
25 if strings.Contains(text, "bad series : try") { 25 if strings.Contains(text, "bad series : try") {
26 return nil, CharacterNotFound 26 return nil, CharacterNotFound
27 } 27 }
28 if strings.Contains(text, "Your IP has been blocked") {
29 return nil, Banned
30 }
28 tds := doc.Find("#besttable > table > tbody > tr > td") 31 tds := doc.Find("#besttable > table > tbody > tr > td")
29 val, _ := tds.Eq(0).Find("img").Attr("src") 32 val, _ := tds.Eq(0).Find("img").Attr("src")
30 c["__thumb"] = val 33 c["__thumb"] = val
diff --git a/tools/charcrawler/crawler/crawler.go b/tools/charcrawler/crawler/crawler.go
index 337bc76..64d1a27 100644
--- a/tools/charcrawler/crawler/crawler.go
+++ b/tools/charcrawler/crawler/crawler.go
@@ -23,6 +23,7 @@ var Instances []Crawler
23var ( 23var (
24 CrawlError = errors.New("Error while crawling") 24 CrawlError = errors.New("Error while crawling")
25 CharacterNotFound = errors.New("Character not found") 25 CharacterNotFound = errors.New("Character not found")
26 Banned = errors.New("Crawler banned from source")
26) 27)
27 28
28func Start(c Crawler) { 29func Start(c Crawler) {