File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
const puppeteer = require ( 'puppeteer' ) ;
2
- const http = require ( 'http' ) ;
3
2
4
3
const connect = async ( url ) => {
5
4
const browser = await puppeteer . launch ( { args : [ '--disabled-setuid-sandbox' , '--no-sandbox' ] } ) ;
@@ -42,9 +41,16 @@ const connect = async (url) => {
42
41
} ;
43
42
44
43
const getReviews = ( url ) => {
44
+ let rev ;
45
45
connect ( url ) . then ( ( data ) => {
46
- console . log ( JSON . stringify ( data ) ) ;
46
+ rev = data ;
47
47
} ) ;
48
+ return JSON . stringify ( rev ) ;
48
49
} ;
49
50
50
- getReviews ( "https://www.google.fr/maps/place/A+tout+gamer+2.0/@48.9543665,2.8773257,17z/data=!3m1!4b1!4m5!3m4!1s0x47e8a17426f68255:0x6e147b67bf598b81!8m2!3d48.954363!4d2.8795144" ) ;
51
+ const server = http . createServer ( async ( req , res ) => {
52
+ data = await getReviews ( 'https://www.google.com/maps/place/PACA+PROPERTY/@43.3044293,5.3650846,845m/data=!3m2!1e3!4b1!4m5!3m4!1s0x12c9c1e868092f43:0x2ad1fc8819550843!8m2!3d43.3044254!4d5.3672733' )
53
+ res . setHeader ( 'Content-Type' , 'application/json' ) ;
54
+ res . writeHead ( 200 ) ;
55
+ res . end ( data ) ;
56
+ } ) ;
You can’t perform that action at this time.
0 commit comments