爬取可购买的比赛信息

import datetime
import json
import time
import requests
import pymysql
from datetime import date, timedeltaurl="https://webapi.sporttery.cn/gateway/jc/football/getMatchCalculatorV1.qry?poolCode=hhad,had&channel=c"headers={"Content-Type":" application/json"
}def getdata():responese=requests.get(url,headers).textresponese=json.loads(responese)all=len(responese['value']['matchInfoList'])for j in range(0,all):day1 = responese['value']['matchInfoList'][j]['businessDate']print(day1)dslen = len(responese['value']['matchInfoList'][j]['subMatchList'])for i in range(0,dslen):num=responese['value']['matchInfoList'][j]['subMatchList'][i]['matchNum']addname=responese['value']['matchInfoList'][j]['subMatchList'][i]['leagueAbbName']zhuname=responese['value']['matchInfoList'][j]['subMatchList'][i]['homeTeamAllName']kename=responese['value']['matchInfoList'][j]['subMatchList'][i]['awayTeamAbbName']lens=len(responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'])for z in range(0,lens):hh=responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][z]['poolCode']if z==0 and hh=="HHAD":rasheng =responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['a']rhsheng=responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['h']rd=responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['d']rang1 = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['goalLine']elif z==1 and hh=="HAD":asheng = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['a']hsheng = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['h']d = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['d']rang = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['goalLine']elif z==0 and hh=="HAD":asheng =responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['a']hsheng=responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['h']d=responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['d']rang1 = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][0]['goalLine']elif z==1 and hh=="HHAD":rasheng = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['a']rhsheng = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['h']rd = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['d']rang = responese['value']['matchInfoList'][j]['subMatchList'][i]['oddsList'][1]['goalLine']else:breakprint("-------------"+addname+"-------------")print(num)print(zhuname + "-" + kename + "[0]   胜 " + hsheng + "--平 " + d + "--负 " + asheng)print(zhuname + "-" + kename + "["+rang+rang1+"]   胜 " + rhsheng + "--平 " + rd + "--负 " + rasheng)

爬取比赛结果

def amidithion():starttime=date.today() + timedelta(days = -1)endtime=time.strftime("%Y-%m-%d",time.localtime())url="https://webapi.sporttery.cn/gateway/jc/football/getMatchResultV1.qry?matchPage=1&pcOrWap=0&leagueId=&matchBeginDate="+str(starttime)+"&matchEndDate="+str(endtime)response=requests.get(url).textprint(url)response=json.loads(response)lenght=len(response['value']['matchResult'])for i in range(0,lenght):day=str(starttime).replace("-","")num=str(response['value']['matchResult'][i]['matchNum'])score=response['value']['matchResult'][i]['sectionsNo999']win=response['value']['matchResult'][i]['winFlag']goalLine=response['value']['matchResult'][i]['goalLine']if score=="取消":continueif win=="A":win="负"elif win=="H":win="胜"else:win="平"a=int(score[2])if goalLine[0]=="+":h=int(score[0])+int(goalLine[1])else:h=int(score[0]) - int(goalLine[1])if a>h:rwin="让负"elif a<h:rwin="让胜"else:rwin="让平"id = str(day + num)print(num+",比分:"+score+"比赛结果:"+win+",让球结果:"+rwin)

python爬取足球比赛信息(一)相关推荐

  1. 使用python爬取足球比赛数据,关于足球预测策略模型,这是我见过唯一三年都盈利的

    市场上有很多基于程序自动化的足球预测模型,我本人也不断摸索,自学python,最终实现了程序预测的自动化,并且验证了很多策略,几乎所有的模型都是阶段性表现很不错,但是长期总体下来,都达不到预期,很多时 ...

  2. python爬取自如房间信息(一)

    使用python和selenium+Chrome Headless爬取自如房间信息,并将结果存储在MongoDB中.其中最麻烦的应该是每间房的价格,因为自如是用一张图片和offset来显示价格,所以不 ...

  3. 2021最新 python爬取12306列车信息自动抢票并自动识别验证码(三)购票篇

    项目前言 tiebanggg又来更新了,项目--[12306-tiebanggg-master]注:本项目仅供学习研究,如若侵犯到贵公司权益请联系我第一时间进行删除:切忌用于一切非法途径,否则后果自行 ...

  4. php爬取房源,用python爬取二手房交易信息并进行分析

    用python爬取二手房交易信息并分析第一步:编写爬虫 爬取某平台上海市十个区共900条二手房的交易信息#爬取上海十个区的二手房价信息 import requests from bs4 import ...

  5. 2021最新python爬取12306列车信息自动抢票并自动识别验证码

    项目描述 项目前言 tiebanggg又来更新了,项目--[12306-tiebanggg-master]注:本项目仅供学习研究,如若侵犯到贵公司权益请联系我第一时间进行删除:切忌用于一切非法途径,否 ...

  6. python爬取12306列车信息自动抢票并自动识别验证码(一)列车数据获取篇

    项目前言 自学python差不多有一年半载了,这两天利用在甲方公司搬砖空闲之余写了个小项目--[12306-tiebanggg-master].注:本项目仅供学习研究,如若侵犯到贵公司权益请联系我第一 ...

  7. python爬取12306列车信息自动抢票并自动识别验证码(二)selenium登录验证篇

    项目前言 自学python差不多有一年半载了,这两天利用在甲方公司搬砖空闲之余写了个小项目--[12306-tiebanggg-master]注:本项目仅供学习研究,如若侵犯到贵公司权益请联系我第一时 ...

  8. python爬取天猫商品信息

    python爬取天猫商品信息 主要信息有:商品名,价格,月销量,评论数,人气值,店铺评分 以智能手机为例! 首先,发掘网址规律: 第二页的网址如上 第三页的网址如上 注意网址中的数字(靠近中间位置): ...

  9. python爬取微博用户信息(六)—— 完整代码

    本节为爬取微博用户信息的完整代码,以及项目结构. 感兴趣的小伙伴可以收藏哦! 另外,关于本代码的效果展示,以及教程,点击以下链接即可. python爬取微博用户信息(一)-- 效果展示 python爬 ...

最新文章

  1. 新来了个技术总监:谁再用 @Async 创建线程以后就不用来了!!
  2. 面向对象 - 1.面向过程/2.面向对象/3.如何使用类/4.__init__方法/5.属性查找/6.补充知识/7.可扩展性高...
  3. jakarta ee_关于Jakarta EE软件包名称更改的思考
  4. openfiler与OVM结合过程遇见的问题
  5. LeetCode算法入门- Generate Parentheses -day16
  6. pythonweb好难-(2017)我不建议使用的Python Web框架
  7. 华为云“创原会”:40+技术精英论道云原生2.0
  8. 校招生大规模涨薪、再扩招10000人?大厂抢人有多野?
  9. antd tree搜索并定位_KD-Tree原理详解
  10. linux启动本地远程服务,如何使用SSH在本地控制远程服务器执行命令
  11. HDU 6156 2016ICPC网络赛 G: Palindrome Function(数位DP)
  12. pq分解法中b’怎么求_1.初中数学:含参数不等式组,有两个负整数解,怎么求a的取值范围?...
  13. 用户行为监控(Piwik)
  14. 什么是代理服务器(Proxy)
  15. 影响网站收录的几个因素
  16. git push 报错 Empty reply from server 或 Failed to connect to github.com port 443: Time out
  17. 蓝桥杯 省赛真题寻找 2020
  18. 在Node.js中使用express开启一个web服务器并定义简单中间件函数的使用
  19. input之怎么清除默认值
  20. es7版本数据备份与恢复(生产环境)

热门文章

  1. Unity 3D PC平台发布|| Unity 3D Web 平台发布||Unity 3D Android平台发布
  2. vue 创建一个登录界面
  3. Vue 实现拖拽模块(二)自定义拖拽组件位置
  4. baidumap vue 判断范围_vue--百度地图点覆盖和区域划分
  5. 屏幕录制和视频剪辑Filmage Screen
  6. Acrel-6000/B电气火灾监控系统麻城广场设计与应用
  7. 移动直播明争暗战五年:人性、梦想与资本的碰撞
  8. 火车头采集细节(一)
  9. 【Unity】Unity内存管理与优化(一)内存域、堆栈、垃圾回收、内存泄漏、内存碎片
  10. Mysql培训第二天