# coding: utf-8
#!/usr/bin/python
# #### http://www.openstreetmap.org 的分区后的osm数据批量下载工具(需要python的requests和BeautifulSoup包)。
# 从 http://download.geofabrik.de/ 提取网页中下载连接,然后写入osm-from-geofabrik.txt。
# 然后可以批量下载:** wget -c -i osm-from-geofabrik.txt ** ,或者载入其它的下载工具。
#
# 或者使用crontab定时下载,编写一个geofabrik-dl.txt(内容如下,指定晚上11:00,每周一到周五执行)。
# 然后执行:crontab crontab.txt。
# ```
# 0 23 * * 1-5 wget -c -N -i osm-from-geofabrik.txt
# 0 6 * * 1-5 killall wget
# ```
# 原始数据下载,参考:** http://planet.openstreetmap.org/planet/ **, 最新版本:http://planet.openstreetmap.org/planet/2016/planet-160411.osm.bz2
#
# ##### by openthings@163.com,http://my.oschina.net/u/2306127/blog
from bs4 import BeautifulSoup as bs
import requests as req
from pprint import *
#获取网页内容&