File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1- require ( 'dotenv' ) . config ( )
2-
3- const facebookScrapper = ( ) => {
4-
1+ const faceScrapper = async ( bot , chatId , medias ) => {
2+ try {
3+ await bot . sendMessage ( chatId , 'Processing your link, please wait...' )
4+ await bot . sendVideo ( chatId , medias [ 0 ] . url )
5+ } catch ( error ) {
6+ bot . sendMessage ( chatId , `An error ocurred while processing the link. Try again!` )
7+ }
58}
69
7- module . exports = facebookScrapper
10+ module . exports = {
11+ linkPrefix : 'https://www.facebook.com/' ,
12+ handle : faceScrapper
13+ }
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ const options = {
1313 'X-RapidAPI-Host' : APIHost
1414 } ,
1515 data : {
16- url : 'https://br.pinterest .com/pin/58757970133022487/ '
16+ url : 'https://www.facebook .com/reel/1273876849979229 '
1717 }
1818} ;
1919
2020const runScrapper = async ( ) => {
2121 try {
2222 const response = await axios . request ( options ) ;
23- console . log ( response . data . medias . reverse ( ) [ 0 ] ) ;
23+ console . log ( response . data . medias ) ;
2424 } catch ( error ) {
2525 console . error ( error ) ;
2626 }
You can’t perform that action at this time.
0 commit comments