import re
import urllib.request

req = urllib.request.Request("http://www.lianjiang.gov.cn/gkmlpt/index", headers={"User-Agent": "Mozilla/5.0"})
html = urllib.request.urlopen(req, timeout=30).read().decode()

# Find names and ids  
for m in re.finditer(r'"name":"([^"]+)"', html):
    name = m.group(1)
    # Find the nearest id before this name
    before = html[:m.start()]
    id_m = re.findall(r'"id":(\d+)', before)
    if id_m:
        cid = id_m[-1]
        print("id=" + cid + ": " + name)
