From 271733764adea48fb2022112d2711624582028c5 Mon Sep 17 00:00:00 2001 From: Lokesh_Choudhary <40513028+lokeshchoudhary-lc@users.noreply.github.com> Date: Mon, 17 Jun 2024 12:56:30 +0530 Subject: [PATCH] fix : a:not(:last-child) only works if it has more than one elements otherwise it neglects it and return null --- src/agents/advancedName.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/agents/advancedName.ts b/src/agents/advancedName.ts index b57b8f4..cfbbcf2 100644 --- a/src/agents/advancedName.ts +++ b/src/agents/advancedName.ts @@ -40,10 +40,12 @@ export const advancedName = generateAgent('https://advanced.name/freeproxy', asy full: `${host}:${port}`, country: elem.find('td:nth-child(5) > a').text().trim().toLowerCase(), protocol: - [...elem.find('td:nth-child(4) > a:not(:last-child)')] - .map((a) => $(a).text().trim()) - .join(',') - .toLowerCase() || null, + elem.find('td:nth-child(4) > a').length === 1 + ? elem.find('td:nth-child(4) > a').text().trim().toLowerCase() + : [...elem.find('td:nth-child(4) > a:not(:last-child)')] + .map((a) => $(a).text().trim()) + .join(',') + .toLowerCase() || null, anonymity: elem.find('td:nth-child(4) > a').length === 1 ? null