zoukankan      html  css  js  c++  java
  • 批处理获取虎牙直播视频流 代码更简洁 利用jq解析json

    包含 Base64Decode.exe jq.exe 链接: https://pan.baidu.com/s/13pVJU8X6Nx72deVnrZfDwg 提取码: pe4p

    @echo off
    
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: IMPORTANT User-Agent Must be set to -user_agent "HYSDK(Windows, 20000308)" ::
    ::::::::::::::::::::::::::::::::::::::::::::::::::::^^^^^^^^^^^^^^^^^^^^^^^^::::
    chcp 65001 1>nul 2>nul
    
    set roomid=%~1
    if "%roomid%"=="" (
    echo Usage: %~n0 [HUYA Room ID] or [HUYA Room URL]
    echo   Example %~n0 123456
    echo   Example %~n0 https://www.huya.com/123456
    exit /b
    )
    
    set "roomid=%roomid: =%"
    set "roomid=%roomid:https://www.huya.com/=%"
    
    :loop
    set inurl=https://www.huya.com/%roomid%
    FOR /F "delims=" %%i IN ('curl -sk %inurl%^|grep -Eo """stream""(.*)" ^| grep -Eo """(.*)""" ^| sed "s/stream//g;s/://g;s/""//g;s/ //g"^|base64decode') DO set "data=%%i"
    
    echo [FlvUrls]
    echo %data% |jq -M -r ".data[].gameStreamInfoList[]| .sFlvUrl +"/"+.sStreamName+"."+.sFlvUrlSuffix +"?"+.sFlvAntiCode"|sed "s/amp;//g"
    echo [HlsUrls]
    echo %data% |jq -M -r ".data[].gameStreamInfoList[]| .sHlsUrl +"/"+.sStreamName+"."+.sHlsUrlSuffix +"?"+.sFlvAntiCode"|sed "s/amp;//g"
    ::echo.
    ::echo %data% |jq -M -r ".data[].gameStreamInfoList[]| .sP2pUrl +"/"+.sStreamName+"."+.sP2pUrlSuffix +"?"+.sFlvAntiCode"|sed "s/amp;//g"

    包含 Base64Decode.exe jq.exe 链接: https://pan.baidu.com/s/13pVJU8X6Nx72deVnrZfDwg 提取码: pe4p

  • 相关阅读:
    最好的我们
    外滩
    外滩
    Java EE (5) -- Java EE 6 JavaServer Faces Developer Certified Expert(1z0-896)
    列表list(序列)、元组tuple(序列)
    P1165 日志分析 洛谷
    T1365 浴火银河星际跳跃 codevs
    T1503 愚蠢的宠物 codevs
    P2820 局域网 洛谷
    T1992 聚会 codevs
  • 原文地址:https://www.cnblogs.com/nlsoft/p/13488375.html
Copyright © 2011-2022 走看看