Skip to content

Commit 763ec56

Browse files
committed
fixing bug
1 parent 488f0df commit 763ec56

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/http/post-index/helpers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ exports.checkIfContainsVideoOrGif = (data) => {
7676
!data.hasOwnProperty("extended_entities") ||
7777
!data.extended_entities.media[0].video_info
7878
)
79-
throw new Error(605);
79+
return false;
80+
else return true;
8081
};
8182

8283
exports.getBitrate = (data) => {

src/http/post-index/index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,16 @@ exports.handler = async function http(req) {
8888

8989
data = data.data;
9090

91-
// If it is a quoted tweet, we find the data for the tweet quoted
92-
if (data.quoted_status_id) {
93-
data = data.quoted_status;
91+
// If video is not found, we check if it is a quoted tweet
92+
if (!checkIfContainsVideoOrGif(data)) {
93+
if (data.quoted_status_id) {
94+
// If it is a quoted tweet, we find the data for the tweet quoted
95+
data = data.quoted_status;
96+
// Check for the video in the quoted tweet. If we still can't find video, we throw error
97+
if (!checkIfContainsVideoOrGif(data)) throw new Error(605);
98+
} else throw new Error(605);
9499
}
95100

96-
checkIfContainsVideoOrGif(data);
97-
98101
// Getting bitrate to calculate the size of the video
99102
let bitrates = getBitrate(data);
100103

0 commit comments

Comments
 (0)