1
This commit is contained in:
Alex Yatskov 2015-08-13 16:31:38 +09:00
parent 27bf94505c
commit 2176ebebb9
3 changed files with 3 additions and 3 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
search-scrape
web_cache
webcache

View File

@ -23,5 +23,5 @@
package main
func main() {
scrapeTabelog("http://tabelog.com/en/kanagawa/rstLst/1/", "tabelog.json", "web_cache")
scrapeTabelog("http://tabelog.com/en/kanagawa/rstLst/1/", "tabelog.json", "webcache")
}

View File

@ -49,7 +49,7 @@ func newWebCache(baseDir string) (*webCache, error) {
func (c *webCache) urlToLocal(url string) string {
hash := md5.New()
hash.Write([]byte(url))
return path.Join(c.baseDir, fmt.Sprintf("%x", hash.Sum(nil)))
return path.Join(c.baseDir, fmt.Sprintf("%x.html", hash.Sum(nil)))
}
func (c *webCache) fetchUrl(url string) (*goquery.Document, error) {