Fixups
This commit is contained in:
parent
27bf94505c
commit
2176ebebb9
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
search-scrape
|
search-scrape
|
||||||
web_cache
|
webcache
|
||||||
|
@ -23,5 +23,5 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
func 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")
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ func newWebCache(baseDir string) (*webCache, error) {
|
|||||||
func (c *webCache) urlToLocal(url string) string {
|
func (c *webCache) urlToLocal(url string) string {
|
||||||
hash := md5.New()
|
hash := md5.New()
|
||||||
hash.Write([]byte(url))
|
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) {
|
func (c *webCache) fetchUrl(url string) (*goquery.Document, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user