Skip to content

Commit bac81f4

Browse files
server hosting
1 parent 3c174ff commit bac81f4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

server/index.js

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

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

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

4240
await page.waitForTimeout(90000);
4341

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

7876
console.log(wholeData);
79-
80-
await browser.close();
81-
})();
82-
res.send({
77+
res.send({
8378
wholeData: wholeData
8479
});
80+
await browser.close();
81+
})();
82+
8583
})
8684

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

0 commit comments

Comments
 (0)