Skip to content

Commit

Permalink
improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kylon committed Nov 14, 2022
1 parent 2be03c4 commit 96b2914
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ const SharedownAPI = (() => {
urlObj.searchParams.set('pretranscode', '0');
urlObj.searchParams.set('transcodeahead', '0');

api.writeLog("_makeVideoManifestFetchURL:\nurl:"+_hideToken(donorRespData.ListSchema['.driveAccessToken'], urlObj.toString()) +
'\n\nresp dump:\n'+_tryRemoveUserDataFromRespDumpForLog(donorRespData));
api.writeLog("_makeVideoManifestFetchURL:\nurl:" + _hideToken(donorRespData.ListSchema['.driveAccessToken'], urlObj.toString()) +
'\nresp dump:\n' + _tryRemoveUserDataFromRespDumpForLog(donorRespData));

return {uobj: urlObj, err: hasErr};
}
Expand Down Expand Up @@ -518,11 +518,14 @@ const SharedownAPI = (() => {
}

async function _getFileName(donorURLObj) {
const docid = donorURLObj.searchParams.get('docid');
const tok = donorURLObj.searchParams.get('access_token');
const axios = require('axios');
const resp = await axios.get(donorURLObj.searchParams.get('docid') + '&access_token=' + donorURLObj.searchParams.get('access_token'));
let resp;

api.writeLog("_getFileName:\ndocid: "+donorURLObj.searchParams.get('docid')+'\n\n' +
"url: "+_hideToken(donorURLObj.searchParams.get('access_token'), donorURLObj.toString()));
api.writeLog(`_getFileName:\ndocid: ${docid}\nurl: ` + _hideToken(tok, donorURLObj.toString()));

resp = await axios.get(`${docid}&access_token=${tok}`);

return resp.data.hasOwnProperty('name') ? resp.data['name'] : '';
}
Expand Down
2 changes: 2 additions & 0 deletions sharedown/sharedown.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ async function downloadVideo(videoElem) {
globalSettings.userdataFold, globalSettings.customChomePath, isDirectDownloader);
toggleLoadingScr();

sharedownApi.writeLog('downloadVideo: has vdata: ' + (vdata !== null));

if (!vdata)
return rej();

Expand Down

0 comments on commit 96b2914

Please sign in to comment.