MiraiForum

    • 注册
    • 登录
    • 搜索
    • 热门
    • 最新
    • 未解决
    • 标签
    • 群组
    • 友情链接

    未解决 想找一个b站视频下载转发到qq群的助手

    使用交流
    5
    6
    704
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • K
      kerwenard 最后由 kerwenard 编辑

      在隔壁群看到的,但是无论怎么搜关键字都找不到类似的,有没有用过的大佬知道

      3647b18f-97f6-425a-979a-e29c79522b39-image.png

      B 1 条回复 最后回复 回复 引用 0
      • Topic has been marked as a question  K kerwenard 
      • K
        kerwenard 最后由 编辑

        有大佬知道吗

        1 条回复 最后回复 回复 引用 0
        • M
          Michael1015198808 最后由 Michael1015198808 编辑

          我有一个用you-get的方法,不过不是很优雅,抛砖引玉吧

          object YougetCommand: SimpleCommand(
              owner = PluginMain,
              "youget",
              "you-get",
              description = "you-get"
          ) {
              private var cnt = 0
              private var lock = Any()
              private fun getNo(): Int {
                  synchronized(lock) {
                      cnt += 1
                      return cnt
                  }
              }
              private fun get(process: Process): String {
                  return String(process.inputStream.readNBytes(process.inputStream.available()))
              }
              @Handler
              suspend fun CommandSenderOnMessage<GroupMessageEvent>.run(arg: String, refresh: Long? = null) {
                  val cookie =
                      if (arg.contains("bilibili")) {
                          "/home/michael/cookies/bilibili/youget.txt"
                      } else {
                          null
                      }
                  val no = getNo()
                  var cmdline = "you-get $arg -O /tmp/mirai-$no"
                  if (cookie != null) {
                      cmdline += " -c $cookie"
                  }
                  val f = File("/tmp/").listFiles { _, name -> name.contains("mirai-$no") }.firstOrNull()
                  if (f != null) {
                      f.delete()
                  }
                  val process = ProcessBuilder(cmdline.split(' ')).start()
                  var title = "untitled"
                  var s = ""
                  while (!process.waitFor(1, TimeUnit.SECONDS)) {
                      s += get(process)
                      if (s.contains("Downloading ")) {
                          fromEvent.subject.sendMessage(s.substring(0, s.lastIndexOf("\n")))
                          val titleLine = s.split("\n")[1]
                          title = titleLine.substring(titleLine.lastIndexOf(' ') + 1)
                          "\\/:*?\"<>|".forEach {
                              title = title.replace(it, '_')
                          }
                          s = s.substring(s.lastIndexOf("\n") + 1)
                      }
                  }
                  if (refresh != null) {
                      do {
                          s += get(process)
                          val pos = s.lastIndexOf('\r')
                          if (pos != -1) {
                              val sub = s.substring(0, pos)
                              val pos2 = sub.lastIndexOf('\r')
                              s = s.substring(pos2)
                              fromEvent.subject.sendMessage(sub.substring( pos2 + 1))
                          }
                      } while(!process.waitFor(refresh, TimeUnit.SECONDS))
                  } else {
                      while(!process.waitFor(1, TimeUnit.SECONDS));
                  }
                  val video = File("/tmp/").listFiles { _, name -> name.contains("mirai-$no") }.firstOrNull()
                  if (video != null) {
                      val ext = video.extension
                      // fromEvent.subject.sendMessage("Uploading ...")
                      println(video.length())
                      fromEvent.group.files.uploadNewFile(
                          "/$title.$ext",
                          video.toExternalResource(ext).toAutoCloseable(),
                          object : ProgressionCallback<AbsoluteFile, Long> {
                              var last = 0
                              val tot = video.length()
                          }
                      )
                      // video.delete()
                  } else {
                      fromEvent.subject.sendMessage("file not found!")
                  }
              }
          }
          
          1 条回复 最后回复 回复 引用 0
          • B
            buchimogu @kerwenard 最后由 编辑

            @kerwenard yunzai的R插件

            1 条回复 最后回复 回复 引用 0
            • F
              fwx5618177 最后由 编辑

              我写过一个,不过是node的。主要的思路是先跳转获取真实地址,然后通过bvid,avid获取cid。然后通过avid和cid去请求接口

              1 条回复 最后回复 回复 引用 0
              • kymandu
                kymandu 最后由 编辑

                我写了一个出来,感兴趣可以看看

                1 条回复 最后回复 回复 引用 0
                • 1 / 1
                • First post
                  Last post
                Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact