Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Please Solve Battery Consumption Too High While Downloading #212

Open
zasdevs opened this issue Nov 8, 2021 · 0 comments
Open

Please Solve Battery Consumption Too High While Downloading #212

zasdevs opened this issue Nov 8, 2021 · 0 comments

Comments

@zasdevs
Copy link

zasdevs commented Nov 8, 2021

Hi Nice Project Thanks For Sharing With Us.

I Have Download This Project and Build Debug APK File But While Downloading 360p Video I Got Notification Battery consumption Too High Close The App & Also Downloading Too Slow. Please Solve This Issue.

Suggestion :
Please Use This Code Instead Of Scraping Because Scraping Use Too Much Time If You Use This Code You Will Get Fast Response Only You Need To Decoding Function. Here Is PHP Version
Or Here You Can Use This Method Of : https://github.com/Athlon1600/youtube-downloader
I don't Know Android Much If I Was Know I Must Be Your Project Contributor.

Once Again Thanks For Sharing Nice Project With us.
rAXOG5oHToE.zip

Link: https://stackoverflow.com/a/68492807

Code

function getVideoInfo($video_id){

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, 'https://www.youtube.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, '{  "context": {    "client": {      "hl": "en",      "clientName": "WEB",      "clientVersion": "2.20210721.00.00",      "clientFormFactor": "UNKNOWN_FORM_FACTOR",   "clientScreen": "WATCH",      "mainAppWebInfo": {        "graftUrl": "/watch?v='.$video_id.'",           }    },    "user": {      "lockedSafetyMode": false    },    "request": {      "useSsl": true,      "internalExperimentFlags": [],      "consistencyTokenJars": []    }  },  "videoId": "'.$video_id.'",  "playbackContext": {    "contentPlaybackContext": {        "vis": 0,      "splay": false,      "autoCaptionsDefaultOn": false,      "autonavState": "STATE_NONE",      "html5Preference": "HTML5_PREF_WANTS",      "lactMilliseconds": "-1"    }  },  "racyCheckOk": false,  "contentCheckOk": false}');
    curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');

    $headers = array();
    $headers[] = 'Content-Type: application/json';
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    $result = curl_exec($ch);
    if (curl_errno($ch)) {
        echo 'Error:' . curl_error($ch);
    }
    curl_close($ch);
    return $result;

}

Also I Have Attached A Json Response From Athlon1600/youtube-downloader Add a Feature To Involve Api Request Hosted On Server.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant