File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ exports.checkIfContainsVideoOrGif = (data) => {
76
76
! data . hasOwnProperty ( "extended_entities" ) ||
77
77
! data . extended_entities . media [ 0 ] . video_info
78
78
)
79
- throw new Error ( 605 ) ;
79
+ return false ;
80
+ else return true ;
80
81
} ;
81
82
82
83
exports . getBitrate = ( data ) => {
Original file line number Diff line number Diff line change @@ -88,13 +88,16 @@ exports.handler = async function http(req) {
88
88
89
89
data = data . data ;
90
90
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 ) ;
94
99
}
95
100
96
- checkIfContainsVideoOrGif ( data ) ;
97
-
98
101
// Getting bitrate to calculate the size of the video
99
102
let bitrates = getBitrate ( data ) ;
100
103
You can’t perform that action at this time.
0 commit comments