mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-26 16:18:51 +00:00
Small changes
This commit is contained in:
@@ -159,7 +159,7 @@ class InnerTube {
|
||||
stream.emit('video_details', { video_details, selected_format, formats });
|
||||
|
||||
if (options.type == 'both') {
|
||||
const response = await axios.get(selected_format.url, { responseType: 'stream', headers: Constants.req_opts.stream_headers() }).catch((error) => error);
|
||||
const response = await axios.get(selected_format.url, { responseType: 'stream', headers: Constants.stream_headers() }).catch((error) => error);
|
||||
if (response instanceof Error) {
|
||||
stream.emit('error', { message: response.message, type: 'REQUEST_FAILED' });
|
||||
return stream;
|
||||
@@ -189,7 +189,7 @@ class InnerTube {
|
||||
|
||||
const downloadChunk = async () => {
|
||||
|
||||
const response = await axios.get(selected_format.url, { responseType: 'stream', headers: Constants.req_opts.stream_headers(`bytes=${chunk_start}-${chunk_end || ''}`) }).catch((error) => error);
|
||||
const response = await axios.get(selected_format.url, { responseType: 'stream', headers: Constants.stream_headers(`bytes=${chunk_start}-${chunk_end || ''}`) }).catch((error) => error);
|
||||
if (response instanceof Error) {
|
||||
stream.emit('error', { message: response.message, type: 'REQUEST_FAILED' });
|
||||
return stream;
|
||||
@@ -239,7 +239,7 @@ class InnerTube {
|
||||
if (!desktop) {
|
||||
response = await axios.get(Constants.urls.YT_WATCH_PAGE + '?v=' + id + 't=8s&pbj=1&bpctr=9999999999&has_verified=1&', Constants.innertube_request_opts({ session: this, id, desktop: false })).catch((error) => error);
|
||||
} else {
|
||||
response = await axios.post(Constants.urls.YT_BASE_URL + '/youtubei/v1/player?key=' + this.key, JSON.stringify(Constants.req_opts.video_data_req_body(id, this.sts, this.context)), Constants.innertube_request_opts({ session: this, id, desktop: true })).catch((error) => error);
|
||||
response = await axios.post(Constants.urls.YT_BASE_URL + '/youtubei/v1/player?key=' + this.key, JSON.stringify(Constants.video_details_req_body(id, this.sts, this.context)), Constants.innertube_request_opts({ session: this, id, desktop: true })).catch((error) => error);
|
||||
}
|
||||
if (response instanceof Error) throw new Error('Could not retrieve watch page info: ' + response.message);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user