GithubHelp home page GithubHelp logo

motebaya / bilibili-dl Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 1020 KB

PHP CLI Script for download video from bilibili.com

License: MIT License

PHP 100.00%
bilibili-download cli downloader guzzlehttp php-cli

bilibili-dl's Introduction

Bilibili-dl


PHP cli Tool for download videos from bilibili.com

php php Scraper License: MIT total stars GitHub forks

Introduction

CLI tool for downloading videos from the bilibili.com website. although you can download directly from the mobile app, but you'il see annoying watermark and limited video quality (unless you subscribe to bilibili).

for example see:

graph TB
A[bilibili url] -->  B[Without Login]
B ---> C[32/480p, 16/360P]
A ---> D[With Login]
D ---> E[80/1080P, 64/720P, 32/480P, 16/360P]
D ---> F((Subscribe))
F ---> G[120/2160P, 116/1080P60FPs, 80/1080P, 64/720P, 32/480P, 16/360P]

so, to get high quality from webpage you need a login and set cookie. see How to get and set cookies

Install

git clone https://github.com/motebaya/bilibili-dl
cd bilibili-dl
composer i

php7.4.33: https://www.php.net/releases/#7.4.33

composer: https://getcomposer.org/download/

main: php7.4 cli.php

Usage (CLI):

  • -u,--url/userid: url video or user id
  • -b, --bookmark: action to download from bookmark/favorite list
  • -t, --type: method type [webpage, api, site]
  • Method list

    • webpage:

      direct scrape from url video, this method will be download separated media (video and audio). then merger it using PHP-FFMpeg

      if you see an error:

      Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutableNotFoundException: Executable not found, proposed :
      

      try change ffmpeg and ffprobe default path to this line with your binary path.see official docs.

      e.g : https://www.bilibili.com/video/BV<videoid>

    • api: download using bilibili api

    • site: download from external downloader website: youtube4kdownloader

  • Example Usage:

    download from url with method webpage:

    • php7.4 cli.php -u https://www.bilibili.com/video/BV<videoid> -t webpage

    download from bookmark by userid with method api:

    • php7.4 cli.php -u 32638440 -t api -b

downloaded media will saved in default folder "src/Downloader/media" with name "media-title.[ext]", you can move it manually.

Cookies

this is optional, for used to get more high quality only.

  1. Login you account to bilibili.com, you can using addon/extension Cookiedough. example
  2. copy your cookies and put (overwrite) to file cookies

Issue

  • not all stream audio or video from webpage always work, sometime you'il see unavailabe response. e.g:
An error occurred while processing your request.<p>
Reference&#32;&#35;132&#46;e6eece17&#46;1694877766&#46;1654822b
</BODY></HTML>

and

<html>
<head><title>403 Forbidden</title></head>
<body>
<h1>403 Forbidden</h1>
<p>You don't have permission to access the URL on this server.<hr/>Powered by Tengine</body>
</html>
An error occurred from remote video site. Please try with other download link
  • and last, for Api's. it's seem not work with hotspot network. bcs im try it in my mobile network it's work as well, but in my PC stuck loading. idk, why ??

Refference

License

This project is licensed under the MIT License.

bilibili-dl's People

Contributors

motebaya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

deyman12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.