Update index.js
Browse files
index.js
CHANGED
|
@@ -27,7 +27,6 @@ app.all('/', (req, res) => {
|
|
| 27 |
})
|
| 28 |
})
|
| 29 |
|
| 30 |
-
|
| 31 |
app.get('/api', async (req, res) => {
|
| 32 |
try {
|
| 33 |
const { url } = req.query
|
|
@@ -64,13 +63,13 @@ async function xbuddy(url) {
|
|
| 64 |
const page = await context.newPage()
|
| 65 |
|
| 66 |
await page.goto(`https://9xbuddy.in/process?url=${url}`)
|
| 67 |
-
|
| 68 |
const response = await page.waitForResponse(res =>
|
| 69 |
res.url().includes('extract') && res.request().method() === 'POST')
|
| 70 |
|
| 71 |
const json = await response.json()
|
| 72 |
|
| 73 |
-
if (json.status) {
|
| 74 |
const html = await page.content()
|
| 75 |
const $ = cheerio.load(html)
|
| 76 |
|
|
|
|
| 27 |
})
|
| 28 |
})
|
| 29 |
|
|
|
|
| 30 |
app.get('/api', async (req, res) => {
|
| 31 |
try {
|
| 32 |
const { url } = req.query
|
|
|
|
| 63 |
const page = await context.newPage()
|
| 64 |
|
| 65 |
await page.goto(`https://9xbuddy.in/process?url=${url}`)
|
| 66 |
+
console.log(await page.content())
|
| 67 |
const response = await page.waitForResponse(res =>
|
| 68 |
res.url().includes('extract') && res.request().method() === 'POST')
|
| 69 |
|
| 70 |
const json = await response.json()
|
| 71 |
|
| 72 |
+
if (json.status && json.response.type !== 'list') {
|
| 73 |
const html = await page.content()
|
| 74 |
const $ = cheerio.load(html)
|
| 75 |
|