Skip to content

Commit 3c174ff

Browse files
server hosting
1 parent dbb41bc commit 3c174ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

server/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ app.get("/",(req,res)=>{
2424

2525
app.post("/link",async(req,res)=>{
2626

27+
let wholeData;
28+
2729
(async () => {
2830
const browser = await puppeteer.launch({ headless: true });
2931
const page = await browser.newPage();
@@ -39,7 +41,7 @@ app.post("/link",async(req,res)=>{
3941

4042
await page.waitForTimeout(90000);
4143

42-
const wholeData = await page.evaluate(() => {
44+
wholeData = await page.evaluate(() => {
4345
return Array.from(
4446
document.querySelectorAll(
4547
"div.sc-1mo3ldo-0 > div:nth-child(1) > div > div:nth-child(1) > div:nth-child(1) > a:nth-child(2)"
@@ -74,12 +76,12 @@ app.post("/link",async(req,res)=>{
7476
});
7577

7678
console.log(wholeData);
77-
res.send({
78-
wholeData: wholeData
79-
});
79+
8080
await browser.close();
8181
})();
82-
82+
res.send({
83+
wholeData: wholeData
84+
});
8385
})
8486

8587
app.listen(port,()=> {

0 commit comments

Comments
 (0)