If using conda
:
# Makes environment if it doesn't exist
conda env list | grep VILF || conda create --name VILF
# Activates the environment
conda activate VILF
If using virtualenv
:
# Makes environment if it doesn't exist
[[ -f venv/bin/activate ]] || virtualenv venv
# Activates the environment
source venv/bin/activate
pip install -r requirements.txt
./vilf build
python3 -m http.server 8080 --directory build
Open localhost:8080
(if you open 0.0.0.0:8080
then the map will not render).
Production IP: https://34.160.129.80:443
- after DNS propagation, this will be
vilf.org
- after DNS propagation, this will be
Testing IP: http://34.160.113.123:80
- This will be dactivated after DNS propagation in favor of HTTP forwarding automatically to HTTPS at
vilf.org
- This will be dactivated after DNS propagation in favor of HTTP forwarding automatically to HTTPS at
These will only work if your account has the right permissions.
gsutil -m rsync -R build gs://climax-scripts-bucket
gcloud compute url-maps invalidate-cdn-cache scripts-lb --path / --project climax-scripts
You can invalidate any specific static file by passing the relative path to the --path
argument.
Using gcloud
:
# CERTIFICATE
gcloud beta compute ssl-certificates describe scripts-ssl --global --format="get(name, managed.status, managed.domainStatus)" --project climax-scripts
# LOAD BALANCER
gcloud compute target-https-proxies describe scripts-lb-target-proxy --project=climax-scripts
gcloud compute target-http-proxies describe scripts-lb-target-proxy-3 --project=climax-scripts
# FORWARDING RULES
gcloud compute forwarding-rules describe scripts-lb-frontend-main --project=climax-scripts --global
gcloud compute forwarding-rules describe scripts-lb-frontend-http-2 --project=climax-scripts --global
Using openssl
:
openssl s_client -showcerts -servername scripts.org -connect 34.160.129.80:443 -verify 99 -verify_return_error
Think of a good search query that will locate your restaurant (e.g. "Lion Dance Cafe"). Run the following from the terminal to see an interactive prompt:
./vilf spatula
# Enter Google Maps search terms (ex: Lion Dance Cafe in Oakland):
Enter the hint:
./vilf spatula
# Enter Google Maps search terms (ex: Lion Dance Cafe in Oakland):
Lion Dance Cafe
The scraper will be able to identify the restaurant automatically and generate a markdown file for you:
./vilf spatula
# Enter Google Maps search terms (ex: Lion Dance Cafe in Oakland):
Lion Dance Cafe
# Waiting for Google Maps page to redirect...
# Using the Google Maps page: https://www.google.com/maps/place/Lion+Dance...
# Name = Lion Dance Café
# Address = 380 17th St
# City = Oakland
# State = CA
# Zip code = 94612
# Phone: None
# Lat, lon = 37.806069, -122.276674
# Successfully wrote markdown to file places/lion-dance-cafe.md
The markdown will contain the fields pre-populated and the relevant values already filled in. The rest is up to you to fill in.
cat lion-dance-cafe.md
# ---
# name: Lion Dance Café
# cuisine:
# address: 380 17th St
# area:
# lat: 37.8060489
# lon: -122.267932
# phone:
# menu:
# drinks:
# visited:
# taste:
# value:
# ---
# <REVIEW>
File name formatting happens automatically. It will safely remove bad characters,
use the restaurant name (and possibly street name, see below), and will append an integer
to the end of the filename in cases of conflict with a preexisting file. You can also flag to use the
city name for the field area
(though you may want to be more specific like "Downtown Oakland").
./vilf spatula --city-as-area --street-in-filename
# ...
# Successfully wrote markdown to file lion-dance-cafe-380-17th-st.md
cat lion-dance-cafe-380-17th-st.md
# ...
# address: 380 17th St
# area: Oakland
# lat: 37.8060489
# ...
Sometimes searches are ambiguous. In this case, the scraper will allow you to select one of the top results from a search or try a different search:
./vilf spatula
# Enter Google Maps search terms (ex: Lion Dance Cafe in Oakland):
Bongo Java Nashville
# Waiting for Google Maps page to redirect...
# I found multiple potential locations, collecting top results...
# Gathering search result data: 100%|█████| 5/5 [00:23<00:00, 4.63s/it]
# 0: Try searching again
# 1: Bongo Java at 2007 Belmont Blvd, Nashville, TN
# 2: Bongo Java East at 107 S 11th St, Nashville, TN
# 3: Bongo Java at 364 Rep. John Lewis Way S, Nashville, TN
# 4: Bongo Java Roasting Co. at 372 Herron Dr, Nashville, TN
# Select one of the above choices to proceed (0 - 4):
3
# Waiting for Google Maps page to redirect...
# Using the Google Maps page: https://www.google.com/maps/place/Bongo+Java...
# Name = Bongo Java
# Address = 364 Rep. John Lewis Way S
# City = Nashville
# State = TN
# Zip code = 37203
# Phone: None
# Lat, lon = 36.157151, -86.776074
# Successfully wrote markdown to file places/bongo-java.md
Alternatively, you can pass in a URL corresponding to a Google Maps restaurant manually. Be careful to escape characters correctly (most terminals will automatically escape upon pasting).
Ex:
./vilf spatula --url https://www.google.com/maps/place/Lion+Dance+Caf%C3%A9/@37.8060737,
-122.270113,17z/data\=\!3m1\!4b1\!4m5\!3m4\!1s0x808f817f59aa5fa9:0xc6930eb94f2d3188\!8m2\!3d37.8060489\
!4d-122.267932
# Waiting for Google Maps page to redirect...
# Name = Lion Dance Café
# Address = 380 17th St
# City = Oakland
# State = CA
# Zip code = 94612
# Phone: None
# Lat, lon = 37.806074, -122.270113
# Successfully wrote markdown to file places/lion-dance-cafe-0.md
Notice the -0
added to the filename to avoid a collision with the original file we produced.
./vilf spatula --ask-first
prompts the user before writing metadata to markdown../vilf spatula --search-query 'lion dance cafe'
or./vilf spatula -s 'lion dance cafe'
avoids the search prompt and jumps right to the action./vilf spatula --directory '/path/to/folder'
allows you to specify the directory for the markdown file (directory doesn't have to exist yet)./vilf spatula --manual-filename '/path/to/folder/filename.md'
allows you to manually specify the output file./vilf spatula --timeout 30.0
let's you set the timeout for the browser (default is 10.0)./vilf spatula --no-headless
let's you see the browser GUI as the searches are being made (kinda fun but not recommended unless debugging)- For more details run
./vilf spatula --help
.
Before committing new markdown files, spatula
can be leveraged to check new files against
Google Maps scraping. Simply run the following from the repo home directory:
./vilf check $(git diff --staged --name-only places/)
If everything looks as expected, you will see
./vilf check $(git diff --staged --name-only places/)
# Testing files:
# ✔ places/lion-dance-cafe.md
# ✔ places/maya-halal-taqueria.md
# All files look good.
If anything is wrong, the metadata will be displayed:
./vilf check $(git diff --staged --name-only places/)
# Testing files:
# ✘ places/lion-dance-cafe.md
# ✔ places/maya-halal-taqueria.md
# The following files may need inspection:
# places/lion-dance-cafe.md
# Current address: 382 17th St | Determined address: 380 17th St
# Current latitude: 34.8060489 | Determined latitude: 37.8060489
# Current longitude: -120.267932 | Determined longitude: -122.267932