爬虫+sql server+node+vue3+leaflet+supermap iclient,实现对医院数据的获取以及展示

刚开始是在做最近地物查询,然后突然想到可以结合前后端做一个医院信息的动态展示

首先打开iserver看一个个医院的的列表

然后随便打开一个,里面有医院的id和name,可以依据名字,然后查找医院的信息(等级还有成立时间等等)

此时观察一下上面的路径“http://localhost:8090/iserver/services/data-changchun/rest/data/datasources/Changchun/datasets/Hospital/features?fromIndex=0&toIndex=13

http://localhost:8090/iserver/services/data-changchun/rest/data/feature/0-27-0

发现第一个前面是不变的,就是fromindex和toindex两个在变。然后看第二个,就是最后的0-27-?,最后?这个数字变一下。Ok,然后打开pycharm,我们开始第一步,提取医院名字和id

import pymssql #引入对数据库操作模块
import requests #等会获得html
from bs4 import BeautifulSoup #
import re #
serverName = '127.0.0.1'
userName = 'sa'
passWord = 'xxxx' #密码
database='hosipital'
conn = pymssql.connect(server=serverName,user=userName,password=passWord,database=database)
cursor = conn.cursor()
creTab='CREATE TABLE inf ( id int, name varchar(100));' #创建一张表
cursor.execute(creTab)
startindex=0
count=0
for startindex in range(0,70,17):
    endindex=startindex+17
    baseUrl = f'http://localhost:8090/iserver/services/data-changchun/rest/data/datasources/Changchun/datasets/Hospital/features?fromIndex={startindex}&toIndex={endindex}'
    r=requests.get(baseUrl)
    r.encoding='utf-8' 
    html=r.text
    soup = BeautifulSoup(html, 'html.parser')
    tds=soup.find_all('td')
    for td in tds:
        a=td.find('a')
        if a:
            txt=a.get('href')
            if re.match('^http.*false$',txt):
                r2=requests.get(txt)
                html2=r2.text
                soup2=BeautifulSoup(html2,'html.parser')
                div=soup2.find('div',class_='bodyDIv').find('div',id="resource
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值