本文实例为大家分享了python爬取足球联赛积分榜的具体代码,供大家参考,具体内容如下
使用BeautifulSoup4解析爬取足球直播吧五大联赛积分榜信息;
#! /usr/bin/python3 # -*- coding:utf-8 -*- from urllib.request import urlopen from urllib.request import quote from bs4 import BeautifulSoup import time import re import json import pymysql url="https://data.zhibo8.cc/pc_main_data/#/dejia/index1" response = urlopen(url) bs = BeautifulSoup(response,"html.parser") # print(bs) liansai_s = bs.select("ul.data_nav > li") # print(liansai_lists) # <li ng-class="{current:current==0}" ng-click="selcuptype(0,'NBA')"> # <a data-index="nba" href="#/team_nba/nba" rel="external nofollow" name="NBA"> # <div class="data_item" ng-class="{current2:current==0}">NBA</div> # <div class="data_item_logo"><img src="/UploadFiles/2021-04-08/nba.png">以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。