Giter Site home page Giter Site logo

Comments (4)

Sudsier avatar Sudsier commented on May 23, 2024 1

问题成功解决,记录惨案:
image

from bilibili-api-collect.

Sudsier avatar Sudsier commented on May 23, 2024

补充一下描述
image
image
image

from bilibili-api-collect.

cxw620 avatar cxw620 commented on May 23, 2024

I strongly suggest that you capture network requests with Charles, Fiddler or any else, and investigate the difference of headers between normal API request and your custom one.

What's more, without code examples passengers cannot help you much.

Seems that server side will detect API request source or any else. Try copy cURL and exec it within your Linux PC.

curl 'https://api.bilibili.com/pgc/player/web/v2/playurl?support_multi_audio=true&avid=875387952&cid=1319952964&qn=80&fnver=0&fnval=4048&fourk=1&gaia_source=&from_client=BROWSER&ep_id=782163&session=5a90f7022988409ff9fa72a3c25cd576&voice_balance=1&drm_tech_type=2' \
  -H 'authority: api.bilibili.com' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: zh-CN,zh;q=0.9' \
  -H 'cache-control: no-cache' \
  -H $'cookie: ***' \
  -H 'dnt: 1' \
  -H 'origin: https://www.bilibili.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://www.bilibili.com/bangumi/play/ep782163' \
  -H 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'sec-gpc: 1' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \
  --compressed

Further investigation is needed.

from bilibili-api-collect.

Sudsier avatar Sudsier commented on May 23, 2024

I strongly suggest that you capture network requests with Charles, Fiddler or any else, and investigate the difference of headers between normal API request and your custom one.

What's more, without code examples passengers cannot help you much.

Seems that server side will detect API request source or any else. Try copy cURL and exec it within your Linux PC.

curl 'https://api.bilibili.com/pgc/player/web/v2/playurl?support_multi_audio=true&avid=875387952&cid=1319952964&qn=80&fnver=0&fnval=4048&fourk=1&gaia_source=&from_client=BROWSER&ep_id=782163&session=5a90f7022988409ff9fa72a3c25cd576&voice_balance=1&drm_tech_type=2' \
  -H 'authority: api.bilibili.com' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: zh-CN,zh;q=0.9' \
  -H 'cache-control: no-cache' \
  -H $'cookie: ***' \
  -H 'dnt: 1' \
  -H 'origin: https://www.bilibili.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://www.bilibili.com/bangumi/play/ep782163' \
  -H 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'sec-gpc: 1' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \
  --compressed

Further investigation is needed.

我使用了您提供的命令(已修改cookie),但仍然没有效果,无法获取1080p以上的内容
并且,我是用的php,这是我的代码(部分代码已省略)

$sessiondata = $_GET['sessiondata'] ?? null;
function geturl($url, $cookie){
    $headerArray = array("Content-type:application/json","Accept:application/json, text/plain, */*","Accept-Language:zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2","Cache-Control:no-cache","Connection:keep-alive","Origin:https://www.bilibili.com");
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
    curl_setopt($ch, CURLOPT_COOKIE, urldecode($cookie));
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_REFERER, "https://www.bilibili.com/");
    curl_setopt($ch,CURLOPT_HTTPHEADER,$headerArray);
    $output = curl_exec($ch);
    curl_close($ch);
    $output = json_decode($output,true);
    return $output;
}
$preurl = "https://api.bilibili.com/pgc/player/web/v2/playurl?avid=" . $_GET['aid'] . "&cid=" . $_GET['cid'] . "&qn=127&fnver=0&fnval=4048&fourk=1&type=dash&otype=json&from_client=BROWSER&drm_tech_type=2";
echo json_encode(geturl($preurl, $sessiondata),JSON_UNESCAPED_UNICODE);

from bilibili-api-collect.

Related Issues (20)

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.