diff options
author | rtz12 <koenig@fagott.pw> | 2016-03-29 16:04:00 (UTC) |
---|---|---|
committer | rtz12 <koenig@fagott.pw> | 2016-03-29 16:04:00 (UTC) |
commit | c90b115314981c2452799df80ec9f5b15cb493ff (patch) | |
tree | 9ba661445b5dab6eaa5c90f665908229c6788c0e /tools/charcrawler | |
parent | 1400381e9c193eb7f681d95616eed9070edaab56 (diff) |
Sperrungsdetektion
Diffstat (limited to 'tools/charcrawler')
-rw-r--r-- | tools/charcrawler/crawler/acd.go | 3 | ||||
-rw-r--r-- | tools/charcrawler/crawler/acd_anime.go | 3 | ||||
-rw-r--r-- | tools/charcrawler/crawler/crawler.go | 1 |
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 | |||
23 | var ( | 23 | var ( |
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 | ||
28 | func Start(c Crawler) { | 29 | func Start(c Crawler) { |