From 1f2248351d9dea56bcdd15ff6bc9d9b5b8266f9b Mon Sep 17 00:00:00 2001 From: Victor Phan Date: Thu, 23 Jul 2026 12:25:01 +0700 Subject: [PATCH] feat: add script to extract and log unique Facebook group names and IDs from DOM elements --- facebook/ChromeConsole | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/facebook/ChromeConsole b/facebook/ChromeConsole index d503c16..f63162c 100644 --- a/facebook/ChromeConsole +++ b/facebook/ChromeConsole @@ -3,13 +3,14 @@ let links = document.querySelectorAll('a[href*="/groups/"]'); links.forEach(a => { let url = a.href.split('?')[0]; let name = a.innerText.trim(); - // Lọc ra các nhóm hợp lệ (có tên và đúng định dạng) - if(name && !name.includes("Joined") && url.includes("facebook.com/groups/")) { - let groupId = url.split('/groups/')[1].replace('/', ''); + + let match = url.match(/\/groups\/([^\/]+)\/?$/); + if(name && !name.includes("Joined") && match) { + let groupId = match[1]; groups.push(name + "\t" + groupId); } }); -// Lọc trùng lặp và in ra màn hình + let uniqueGroups = [...new Set(groups)]; -console.log("TÊN NHÓM \t GROUP ID/LINK"); +console.log("TÊN NHÓM \t GROUP ID (Hoặc Tên Tùy Chỉnh)"); console.log(uniqueGroups.join('\n'));