zachMelody / bilibili-live-recorder

下载 bilibili 直播 视频流
MIT License
77 stars 12 forks source link

Does bilibili-live-recorder support m3u8 playlist returned in durl? #7

Open YunzheZJU opened 4 years ago

YunzheZJU commented 4 years ago

Sorry for my bothering.

Currently, some API for live rooms will return "durl" which is abnormal for bilibili-live-recorder to process. More specifically, it returns something like this:

// https://api.live.bilibili.com/room/v1/Room/playUrl?...
{
  "code": 0,
  "durl": [
    {
      "url": "https://foo.cdn.url/path/to/file/live_000000.m3u8"
     }
  ]
}

I have inspected run.py but found no processing procedure for urls other than those end with ".flv".

Does bilibili-live-recorder support m3u8 playlist returned in durl? If not, is it in the plan?

By the way, I tried to run bilibili-live-recorder on my Windows 10 with just-installed python38, but it failed with the following error.

C:\Users\Yunzhe\Desktop\bilibili-live-recorder> python run.py 1
Traceback (most recent call last):
  File "run.py", line 5, in <module>
    import config
ModuleNotFoundError: No module named 'config'

I'm not quite familiar with python import syntax and hope this project to be run as easily as possible. :)

zachMelody commented 4 years ago
  1. Recently I have no plans to support m3u8. ( Probably soon )
  2. Can you give me some LIVE_ROOM_IDs returning 'm3u8' playlist? I only find the following response.
    • Here is the API processing file: Live/BilibiliLive.py
      {
      "code": 0,
      "message": "0",
      "ttl": 1,
      "data": {
      "current_quality": 4,
      "accept_quality": ["4"],
      "current_qn": 10000,
      "quality_description": [{
          "qn": 10000,
          "desc": "原画"
      }],
      "durl": [{
          "url": "https://ws.live-play.acgvideo.com/live-ws/966597/live_397023645_72901889.flv?wsSecret=290b0346154667e2ede7741dc851d6d6\u0026wsTime=1582706234\u0026trid=b5a229888b7b4123a8afeb07d2da7d9c\u0026pt=web\u0026oi=2574953816\u0026order=1\u0026sig=no",
          "length": 0,
          "order": 1,
          "stream_type": 0
      }, {
          "url": "https://txy.live-play.acgvideo.com/live-txy/953214/live_397023645_72901889.flv?wsSecret=3b922315aea60fd7bb0a5950bf181c58\u0026wsTime=1582706234\u0026trid=b5a229888b7b4123a8afeb07d2da7d9c\u0026pt=web\u0026oi=2574953816\u0026order=2\u0026sig=no",
          "length": 0,
          "order": 1,
          "stream_type": 0
      }, {
          "url": "https://d1--cn-gotcha01.bilivideo.com/live-bvc/477640/live_397023645_72901889.flv?cdn=cn-gotcha01\u0026expires=1582706234\u0026len=0\u0026oi=2574953816\u0026pt=web\u0026qn=10000\u0026trid=b5a229888b7b4123a8afeb07d2da7d9c\u0026sigparams=cdn,expires,len,oi,pt,qn,trid\u0026sign=3a51cef0f43ad39dbdab353422573f79\u0026ptype=0",
          "length": 0,
          "order": 1,
          "stream_type": 0
      }, {
          "url": "https://txy.live-play.acgvideo.com/live-txy/903351/live_397023645_72901889.flv?wsSecret=964e374a7f176578c5a338bee30a5fb2\u0026wsTime=1582706234\u0026trid=b5a229888b7b4123a8afeb07d2da7d9c\u0026pt=web\u0026oi=2574953816\u0026order=4\u0026sig=no",
          "length": 0,
          "order": 1,
          "stream_type": 0
      }]
      }
      }
  3. Rename '.config.py' file to 'config.py' and modify what you want.
YunzheZJU commented 4 years ago

Please check the response with any of the following room_ids/cids

// https://api.live.bilibili.com/room/v1/Room/playUrl?cid=14917277&platform=h5&otype=json&quality=4
{
  "code": 0,
  "message": "0",
  "ttl": 1,
  "data": {
    "current_quality": 4,
    "accept_quality": [
      "4"
    ],
    "current_qn": 10000,
    "quality_description": [
      {
        "qn": 10000,
        "desc": "原画"
      }
    ],
    "durl": [
      {
        "url": "https://d1--cn-gotcha03.bilivideo.com/live-bvc/463737/live_375504219_5528453.m3u8?cdn=cn-gotcha03\u0026expires=1582711610\u0026len=0\u0026oi=1700095682\u0026pt=h5\u0026qn=10000\u0026trid=676edcb41c73488ca40a7cd28d0443c4\u0026sigparams=cdn,expires,len,oi,pt,qn,trid\u0026sign=4cf6e8c2edd676da1f7e66c64beff4a7\u0026ptype=0",
        "length": 0,
        "order": 1,
        "stream_type": 0
      },
      {
        "url": "https://d1--cn-gotcha03.bilivideo.com/live-bvc/410323/live_375504219_5528453.m3u8?cdn=cn-gotcha03\u0026expires=1582711610\u0026len=0\u0026oi=1700095682\u0026pt=h5\u0026qn=10000\u0026trid=676edcb41c73488ca40a7cd28d0443c4\u0026sigparams=cdn,expires,len,oi,pt,qn,trid\u0026sign=3ca75c3a751b487d39044fc2261c805c\u0026ptype=0",
        "length": 0,
        "order": 1,
        "stream_type": 0
      },
      {
        "url": "https://d1--cn-gotcha03.bilivideo.com/live-bvc/232152/live_375504219_5528453.m3u8?cdn=cn-gotcha03\u0026expires=1582711610\u0026len=0\u0026oi=1700095682\u0026pt=h5\u0026qn=10000\u0026trid=676edcb41c73488ca40a7cd28d0443c4\u0026sigparams=cdn,expires,len,oi,pt,qn,trid\u0026sign=d9dd6fd05eb655a57a5035574a9e5630\u0026ptype=0",
        "length": 0,
        "order": 1,
        "stream_type": 0
      },
      {
        "url": "https://d1--cn-gotcha03.bilivideo.com/live-bvc/691637/live_375504219_5528453.m3u8?cdn=cn-gotcha03\u0026expires=1582711610\u0026len=0\u0026oi=1700095682\u0026pt=h5\u0026qn=10000\u0026trid=676edcb41c73488ca40a7cd28d0443c4\u0026sigparams=cdn,expires,len,oi,pt,qn,trid\u0026sign=484eb31d80bee323186ef93854c39209\u0026ptype=0",
        "length": 0,
        "order": 1,
        "stream_type": 0
      }
    ]
  }
}