Skip to content

Commit

Permalink
fixing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
saifalfalah committed Dec 18, 2021
1 parent 488f0df commit 763ec56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/http/post-index/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ exports.checkIfContainsVideoOrGif = (data) => {
!data.hasOwnProperty("extended_entities") ||
!data.extended_entities.media[0].video_info
)
throw new Error(605);
return false;
else return true;
};

exports.getBitrate = (data) => {
Expand Down
13 changes: 8 additions & 5 deletions src/http/post-index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ exports.handler = async function http(req) {

data = data.data;

// If it is a quoted tweet, we find the data for the tweet quoted
if (data.quoted_status_id) {
data = data.quoted_status;
// If video is not found, we check if it is a quoted tweet
if (!checkIfContainsVideoOrGif(data)) {
if (data.quoted_status_id) {
// If it is a quoted tweet, we find the data for the tweet quoted
data = data.quoted_status;
// Check for the video in the quoted tweet. If we still can't find video, we throw error
if (!checkIfContainsVideoOrGif(data)) throw new Error(605);
} else throw new Error(605);
}

checkIfContainsVideoOrGif(data);

// Getting bitrate to calculate the size of the video
let bitrates = getBitrate(data);

Expand Down

0 comments on commit 763ec56

Please sign in to comment.