[爬虫] 爬取 NBA 球队最近的一场比赛数据 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
maxwel1
V2EX    分享创造

[爬虫] 爬取 NBA 球队最近的一场比赛数据

  •  
  •   maxwel1
    leeyeel 221 天前 2210 次点击
    这是一个创建于 221 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码: https://github.com/leeyeel/NBAStatsCrawler


    从 espn 拉取两支球队的比赛数据,球员的个人数据,比赛概览,以及比赛经过。

    主要是想把数据喂给大模型,然后写一些极具争议的球评,比如无脑黑或者无脑吹。

    虽然是无脑黑无脑吹,但是也要有些数据,所以就搞了这个脚本。

    原谅我的恶趣味,毕竟国内球迷是真不看球。。。


    输出内容差不多像这样:

    ### 比赛信息 **比赛 ID:** 401705297 **主队:** Los Angeles Lakers **得分:** 120 **客队:** Golden State Warriors **得分:** 112 ### 球队统计 | 球队 | 得分 | 命中-出手数 | 投篮命中率 | 三分命中率 | 罚球命中率 | 篮板 | 助攻 | 失误 | |------|------|------------|-------------|-----------|------------|------|------|------| | Golden State Warriors | 112 | 41-101 | 40.6 | 30.2 | 70.0 | 40 | 29 | 12 | | Los Angeles Lakers | 120 | 39-78 | 50.0 | 37.1 | 80.6 | 47 | 26 | 13 | ### 球员统计 | team | name | short_name | position | jersey | MIN | FG | 3PT | FT | OREB | DREB | REB | AST | STL | BLK | TO | PF | +/- | PTS | |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| | Golden State Warriors | Draymond Green | D. Green | Power Forward | 23 | 33 | 5-7 | 2-2 | 1-3 | 0 | 5 | 5 | 4 | 2 | 1 | 0 | 5 | -1 | 13 | | Golden State Warriors | Quinten Post | Q. Post | Center | 21 | 11 | 2-5 | 2-5 | 0-0 | 0 | 2 | 2 | 2 | 0 | 0 | 0 | 2 | -17 | 6 | | Golden State Warriors | Stephen Curry | S. Curry | Point Guard | 30 | 37 | 13-35 | 6-20 | 5-5 | 2 | 5 | 7 | 4 | 1 | 1 | 4 | 3 | -3 | 37 | | Golden State Warriors | …… | …… | …… | …… | …… | …… | …… |…… | …… | …… | …… | …… | …… | …… | …… | …… | …… | …… | | Los Angeles Lakers | Dorian Finney-Smith | D. Finney-Smith | Power Forward | 17 | 33 | 3-6 | 1-4 | 0-0 | 0 | 1 | 1 | 3 | 2 | 0 | 2 | 2 | +8 | 7 | | Los Angeles Lakers | Rui Hachimura | R. Hachimura | Power Forward | 28 | 39 | 4-9 | 1-5 | 2-4 | 0 | 4 | 4 | 3 | 0 | 0 | 0 | 3 | +12 | 11 | | Los Angeles Lakers | LeBron James | L. James | Small Forward | 23 | 38 | 14-25 | 6-9 | 8-10 | 1 | 16 | 17 | 8 | 1 | 1 | 3 | 1 | +7 | 42 | | Los Angeles Lakers | …… | …… | …… | …… | …… | …… | …… |…… | …… | …… | …… | …… | …… | …… | …… | …… | …… | …… | ### recap 比赛概述 LOS ANGELES -- <a href="http://www.espn.com/nba/player/_/id/1966/lebron-james">LeBron James</a> had 42 points, 17 rebounds and eight assists, and the <a href="http://www.espn.com/nba/team/_/name/lal/los-angeles-lakers">Los Angeles Lakers</a> blew most of a 26-point lead before hanging on to beat the <a href="http://www.espn.com/nba/team/_/name/gs/golden-state-warriors">Golden State Warriors</a> 120-112 on Thursday night. …… ### Play-by-Play完整比赛 - **[1st Quarter - 12:00]** Quinten Post vs. Jaxson Hayes (LeBron James gains possession) - **[1st Quarter - 11:41]** LeBron James bad pass (Stephen Curry steals) - **[1st Quarter - 11:37]** Jaxson Hayes blocks Stephen Curry 's 4-foot two point shot - **[1st Quarter - 11:37]** Warriors offensive team rebound - **[1st Quarter - 11:27]** Buddy Hield bad pass (Austin Reaves steals) - **[1st Quarter - 11:25]** Austin Reaves makes two point shot - **[1st Quarter - 11:25]** Quinten Post shooting foul - **[1st Quarter - 11:25]** Austin Reaves makes free throw 1 of 1 - **[1st Quarter - 11:09]** Quinten Post makes 25-foot three point jumper (Brandin Podziemski assists) - **[1st Quarter - 10:50]** LeBron James makes 26-foot three point jumper (Jaxson Hayes assists) - **[1st Quarter - 10:38]** Stephen Curry misses 25-foot three point jumper - **[1st Quarter - 10:35]** Rui Hachimura defensive rebound - **[1st Quarter - 10:30]** Austin Reaves misses 18-foot step back jumpshot - **[1st Quarter - 10:27]** Buddy Hield defensive rebound - **[1st Quarter - 10:18]** Stephen Curry bad pass (Dorian Finney-Smith steals) - **[1st Quarter - 10:07]** Quinten Post personal foul - …… 
    3 条回复    2025-03-10 13:27:46 +08:00
    wyntalgeer
        1
    wyntalgeer  
       221 天前   1
    拿下一血
    Psily1017
        2
    Psily1017  
       221 天前
    已 star ,理想化可以结合定时任务,发现存在最近一场信息,自动推送到微信。
    maxwel1
        3
    maxwel1  
    OP
       218 天前
    @Psily1017 比赛日程是早安排好的,也可以根据日程来爬,不过我主要用它爬取出来喂给 chatgpt ,一本最正经作看过球的样子 hah
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2517 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 15:30 PVG 23:30 LAX 08:30 JFK 11:30
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86