Skip to content

Instantly share code, notes, and snippets.

@guysoft
Created August 10, 2020 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guysoft/974571512a5e9be7f249e39373a4f5ab to your computer and use it in GitHub Desktop.
Save guysoft/974571512a5e9be7f249e39373a4f5ab to your computer and use it in GitHub Desktop.
Scrape all electronics recycle places in Israel
#!/usr/bin/env python3
import json
from urllib.request import urlopen
link = "https://mai.org.il/weee_map_israel/"
f = urlopen(link)
data = f.read().decode()
# If you want to try a cache, uncomment this
# with open("page.html") as f:
# data = f.read()
data_1 = data.split('var map1 = $("#map1").maps(')[1]
data_2 = data_1.split(').data("wpg')[0]
json_data = json.loads(data_2)
print(json.dumps(json_data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment