WIKI主页 作者 我的
?
 

现实地铁数据获取教程

(3282) [同群组]  
编辑功能已停用  词条设置
上次编辑于 2023/3/11 9:13:24
创建者蓝洲腐竹
编辑记录(简略) 编辑记录(详细)
相关文件夹
技术
相关推荐
文件夹字数统计的大概原理 词条盖子
获取链接

以高德为例
彭清(雾)
右键页面,选择“检查”,即可跳出如下页面
刷新
一定是subway开头的第一个文件!
打开,复制这个链接,用request库之类的方法获取(别的语言也可以)
链接

北京,http://map.amap.com/service/subway?_1678441427760&srhdata=1100_drw_beijing.json

上海,http://map.amap.com/service/subway?_1678441513252&srhdata=3100_drw_shanghai.json

广州,http://map.amap.com/service/subway?_1678441586823&srhdata=4401_drw_guangzhou.json

深圳,http://map.amap.com/service/subway?_1678441596574&srhdata=4403_drw_shenzhen.json

武汉,http://map.amap.com/service/subway?_1678441605470&srhdata=4201_drw_wuhan.json

天津,http://map.amap.com/service/subway?_1678441632942&srhdata=1200_drw_tianjin.json

南京,http://map.amap.com/service/subway?_1678441642966&srhdata=3201_drw_nanjing.json

香港,http://map.amap.com/service/subway?_1678456913516&srhdata=8100_drw_xianggang.json

重庆,http://map.amap.com/service/subway?_1678459355168&srhdata=5000_drw_chongqing.json

大连,http://map.amap.com/service/subway?_1678459383232&srhdata=2102_drw_dalian.json

苏州,http://map.amap.com/service/subway?_1678459409052&srhdata=3205_drw_suzhou.json

西安,http://map.amap.com/service/subway?_1678459428438&srhdata=6101_drw_xian.json

宁波,http://map.amap.com/service/subway?_1678459444756&srhdata=3302_drw_ningbo.json

南昌,http://map.amap.com/service/subway?_1678459465310&srhdata=3601_drw_nanchang.json

南宁,http://map.amap.com/service/subway?_1678459477832&srhdata=4501_drw_nanning.json

厦门,http://map.amap.com/service/subway?_1678459492138&srhdata=3502_drw_xiamen.json

乌鲁木齐,http://map.amap.com/service/subway?_1678459506272&srhdata=6501_drw_wulumuqi.json

兰州,http://map.amap.com/service/subway?_1678459526156&srhdata=6201_drw_lanzhou.json

太原,http://map.amap.com/service/subway?_1678459539406&srhdata=1401_drw_taiyuan.json

杭州,http://map.amap.com/service/subway?_1678459552624&srhdata=3301_drw_hangzhou.json

成都,http://map.amap.com/service/subway?_1678459564990&srhdata=5101_drw_chengdu.json

佛山,http://map.amap.com/service/subway?_1678459578858&srhdata=4406_drw_foshan.json

郑州,http://map.amap.com/service/subway?_1678496539186&srhdata=4101_drw_zhengzhou.json

无锡,http://map.amap.com/service/subway?_1678496554001&srhdata=3202_drw_wuxi.json

福州,http://map.amap.com/service/subway?_1678496564359&srhdata=3501_drw_fuzhou.json

合肥,http://map.amap.com/service/subway?_1678496574317&srhdata=3401_drw_hefei.json

哈尔滨,http://map.amap.com/service/subway?_1678496584503&srhdata=2301_drw_haerbin.json

温州,http://map.amap.com/service/subway?_1678496599137&srhdata=3303_drw_wenzhou.json

常州,http://map.amap.com/service/subway?_1678496612665&srhdata=3204_drw_changzhou.json

呼和浩特,http://map.amap.com/subway/index.html?&1100

沈阳,http://map.amap.com/service/subway?_1678496640405&srhdata=2101_drw_shenyang.json

长春,http://map.amap.com/service/subway?_1678496651115&srhdata=2201_drw_changchun.json

昆明,http://map.amap.com/service/subway?_1678496662195&srhdata=5301_drw_kunming.json

长沙,http://map.amap.com/service/subway?_1678496671565&srhdata=4301_drw_changsha.json

青岛,http://map.amap.com/service/subway?_1678496682385&srhdata=3702_drw_qingdao.json

东莞,http://map.amap.com/service/subway?_1678496691021&srhdata=4419_drw_dongguan.json

贵阳,http://map.amap.com/service/subway?_1678496700127&srhdata=5201_drw_guiyang.json

石家庄,http://map.amap.com/service/subway?_1678496710188&srhdata=1301_drw_shijiazhuang.json

济南,http://map.amap.com/service/subway?_1678496717844&srhdata=3701_drw_jinan.json

徐州,http://map.amap.com/service/subway?_1678496726494&srhdata=3203_drw_xuzhou.json

代码

import requests as r

import re

import json

def pegkin(city,url):

with open('cheng.txt','r',encoding='utf-8') as a:

tex=a.read()

tex=tex.replace('\n','')

txt=tex.split(' ')

if not url or url=='' or url==None:

for s in txt:

tst=s.split(',')

if city==tst[0]:

url=tst[1]

print(url)

rf=r.get(url)

#获得每个地点和他的位置:

#未找到素材:站点名称

rr=rf.text

js=(json.loads(rr))['l']

jg=[]

for i in js:

xl=[]

name=i['kn']

color=i['cl']

st=i['st']

xl.append(name)

xl.append(color)

for j in st:

stname=j['n']

xl.append(stname)

if city=='北京' and ('地铁2号线'== name or name=='地铁10号线'):

xl.append((st[0])['n'])

if city=='上海' and ('地铁4号线'== name):

xl.append((st[0])['n'])

jg.append(xl)

return jg

相关文件夹
技术
相关推荐
文件夹字数统计的大概原理 词条盖子

评论区

登录后可发表评论
返回
主页

此处为旧版站,数据与新版不互通且将会被丢弃,请勿写入内容
© 2022 - 蓝洲腐竹
若作者不另外说明,本站内容由其作者保留全部所有权,未经允许请勿转载,使用及改编
友情链接   东宁要览  轨交棋 q群   本站新版(测试中) 自然地图生成器
鄂ICP备14015516号