WIP
This commit is contained in:
parent
51e6a08eff
commit
f0c8b6479b
20
cache/geocache.json
vendored
20
cache/geocache.json
vendored
@ -2011,6 +2011,10 @@
|
|||||||
"Latitude": 35.5295726,
|
"Latitude": 35.5295726,
|
||||||
"Longitude": 139.6986515
|
"Longitude": 139.6986515
|
||||||
},
|
},
|
||||||
|
"2-1 Fujimicho Naka-ku Yokohama Kanagawa": {
|
||||||
|
"Latitude": 35.4400805,
|
||||||
|
"Longitude": 139.6328372
|
||||||
|
},
|
||||||
"2-1 Higashidacho, Kawasaki-ku | 2F Matsui Bldg., Kawasaki 210-0005, Kanagawa Prefecture": {
|
"2-1 Higashidacho, Kawasaki-ku | 2F Matsui Bldg., Kawasaki 210-0005, Kanagawa Prefecture": {
|
||||||
"Latitude": 35.5286247,
|
"Latitude": 35.5286247,
|
||||||
"Longitude": 139.7023059
|
"Longitude": 139.7023059
|
||||||
@ -3007,6 +3011,10 @@
|
|||||||
"Latitude": 35.5301614,
|
"Latitude": 35.5301614,
|
||||||
"Longitude": 139.7005458
|
"Longitude": 139.7005458
|
||||||
},
|
},
|
||||||
|
"2-4-19 Shinyokohama Kohoku-ku Yokohama Kanagawa": {
|
||||||
|
"Latitude": 35.5086251,
|
||||||
|
"Longitude": 139.6162458
|
||||||
|
},
|
||||||
"2-4-3 Fujigaoka, Aoba-ku | Fujigaoka Hall B1F, Yokohama 227-0043, Kanagawa Prefecture": {
|
"2-4-3 Fujigaoka, Aoba-ku | Fujigaoka Hall B1F, Yokohama 227-0043, Kanagawa Prefecture": {
|
||||||
"Latitude": 35.5443709,
|
"Latitude": 35.5443709,
|
||||||
"Longitude": 139.5273234
|
"Longitude": 139.5273234
|
||||||
@ -3219,6 +3227,10 @@
|
|||||||
"Latitude": 35.5284589,
|
"Latitude": 35.5284589,
|
||||||
"Longitude": 139.7006264
|
"Longitude": 139.7006264
|
||||||
},
|
},
|
||||||
|
"2-7-8 Isago Kawasaki-ku Kawasaki Kanagawa": {
|
||||||
|
"Latitude": 35.5285672,
|
||||||
|
"Longitude": 139.7006625
|
||||||
|
},
|
||||||
"2-7-8 Minamisaiwai Nishi-ku Yokohama Kanagawa": {
|
"2-7-8 Minamisaiwai Nishi-ku Yokohama Kanagawa": {
|
||||||
"Latitude": 35.4635478,
|
"Latitude": 35.4635478,
|
||||||
"Longitude": 139.617538
|
"Longitude": 139.617538
|
||||||
@ -3975,6 +3987,10 @@
|
|||||||
"Latitude": 35.441597,
|
"Latitude": 35.441597,
|
||||||
"Longitude": 139.6611352
|
"Longitude": 139.6611352
|
||||||
},
|
},
|
||||||
|
"3-4-29 Isogo Isogo-ku Yokohama Kanagawa": {
|
||||||
|
"Latitude": 35.4032608,
|
||||||
|
"Longitude": 139.6189689
|
||||||
|
},
|
||||||
"3-4-3 Akiya, Yokosuka 240-0105, Kanagawa Prefecture": {
|
"3-4-3 Akiya, Yokosuka 240-0105, Kanagawa Prefecture": {
|
||||||
"Latitude": 35.2400862,
|
"Latitude": 35.2400862,
|
||||||
"Longitude": 139.5993922
|
"Longitude": 139.5993922
|
||||||
@ -4511,6 +4527,10 @@
|
|||||||
"Latitude": 35.508616,
|
"Latitude": 35.508616,
|
||||||
"Longitude": 139.4448664
|
"Longitude": 139.4448664
|
||||||
},
|
},
|
||||||
|
"4-50-5 Nakasaiwaicho Saiwai-ku Kawasaki Kanagawa": {
|
||||||
|
"Latitude": 35.5317585,
|
||||||
|
"Longitude": 139.6926631
|
||||||
|
},
|
||||||
"4-52 Tokiwacho Naka-ku Yokohama Kanagawa": {
|
"4-52 Tokiwacho Naka-ku Yokohama Kanagawa": {
|
||||||
"Latitude": 35.4463769,
|
"Latitude": 35.4463769,
|
||||||
"Longitude": 139.6358089
|
"Longitude": 139.6358089
|
||||||
|
9314
data/tabelog.json
9314
data/tabelog.json
File diff suppressed because it is too large
Load Diff
15
scrape.go
15
scrape.go
@ -122,11 +122,11 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
|
|||||||
atmospheric FLOAT NOT NULL,
|
atmospheric FLOAT NOT NULL,
|
||||||
latitude FLOAT NOT NULL,
|
latitude FLOAT NOT NULL,
|
||||||
longitude FLOAT NOT NULL,
|
longitude FLOAT NOT NULL,
|
||||||
distanceToStn FLOAT NOT NULL,
|
closestStnDist FLOAT NOT NULL,
|
||||||
closestStn VARCHAR(100) NOT NULL,
|
closestStnName VARCHAR(100) NOT NULL,
|
||||||
accessCount INT NOT NULL,
|
accessCount INT NOT NULL,
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
|
id INT PRIMARY KEY
|
||||||
) DEFAULT CHARACTER SET utf8`)
|
)`)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -156,7 +156,8 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
|
|||||||
r.longitude,
|
r.longitude,
|
||||||
r.latitude,
|
r.latitude,
|
||||||
r.closestStnDist,
|
r.closestStnDist,
|
||||||
r.closestStnName)
|
r.closestStnName,
|
||||||
|
0)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -171,7 +172,7 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
|
|||||||
DROP TABLE IF EXISTS categories;
|
DROP TABLE IF EXISTS categories;
|
||||||
CREATE TABLE categories(
|
CREATE TABLE categories(
|
||||||
description VARCHAR(200) NOT NULL,
|
description VARCHAR(200) NOT NULL,
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY))`)
|
id INT PRIMARY KEY)`)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -192,7 +193,7 @@ func dumpData(dbPath string, restaraunts []restaurant) error {
|
|||||||
CREATE TABLE history(
|
CREATE TABLE history(
|
||||||
date DATETIME NOT NULL,
|
date DATETIME NOT NULL,
|
||||||
reviewId INT NOT NULL,
|
reviewId INT NOT NULL,
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT PRIMARY KEY,
|
||||||
FOREIGN KEY(reviewId) REFERENCES reviews(id))`)
|
FOREIGN KEY(reviewId) REFERENCES reviews(id))`)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -140,8 +140,8 @@ func scrapeIndex(indexUrl string, out chan restaurant, wc *webCache, scr scraper
|
|||||||
}
|
}
|
||||||
|
|
||||||
func scrape(url string, wc *webCache, gc *geoCache, scr scraper) []restaurant {
|
func scrape(url string, wc *webCache, gc *geoCache, scr scraper) []restaurant {
|
||||||
out := make(chan restaurant)
|
out := make(chan restaurant, 128)
|
||||||
in := make(chan restaurant)
|
in := make(chan restaurant, 128)
|
||||||
|
|
||||||
go scrapeIndex(url, in, wc, scr)
|
go scrapeIndex(url, in, wc, scr)
|
||||||
go decodeReviews(in, out, gc)
|
go decodeReviews(in, out, gc)
|
||||||
|
Loading…
Reference in New Issue
Block a user