fix: replace dev code

This commit is contained in:
dhanush.s 2025-09-27 02:51:04 +05:30
parent 6b8f7e616b
commit 6d6269925b

276
main.js
View File

@ -234,150 +234,150 @@ const observer = new IntersectionObserver((entries) => {
console.log("test");
document.addEventListener('DOMContentLoaded', async () => {
// const allCourses = [];
const allCourses = [];
// const baseUrl = 'https://kodepilot.in/course/index.php';
// const res = await fetch(baseUrl);
// const html = await res.text();
const baseUrl = 'https://kodepilot.in/course/index.php';
const res = await fetch(baseUrl);
const html = await res.text();
// const categoryRegex = /<h3 class="categoryname aabtn"><a href="([^"]+)">([^<]+)<\/a><\/h3>/g;
// const categories = [];
// let match;
// while ((match = categoryRegex.exec(html)) !== null) {
// categories.push({ url: match[1], name: match[2] });
// }
const categoryRegex = /<h3 class="categoryname aabtn"><a href="([^"]+)">([^<]+)<\/a><\/h3>/g;
const categories = [];
let match;
while ((match = categoryRegex.exec(html)) !== null) {
categories.push({ url: match[1], name: match[2] });
}
// for (const category of categories) {
// const resCat = await fetch(category.url);
// const catHtml = await resCat.text();
// const cleanHtml = catHtml.replace(/\n/g, ' ');
for (const category of categories) {
const resCat = await fetch(category.url);
const catHtml = await resCat.text();
const cleanHtml = catHtml.replace(/\n/g, ' ');
// const courseRegex = /<div class="card dashboard-card [^"]*"[^>]*>.*?<a href="([^"]+)"[^>]*>.*?background-image: url\(([^)]+)\);".*?<span class="sr-only">(.*?)<\/span>.*?<div class="course-category">\s*([^<]+)<\/div>.*?<div class="course-summary">.*?<p>(.*?)<\/p>/g;
const courseRegex = /<div class="card dashboard-card [^"]*"[^>]*>.*?<a href="([^"]+)"[^>]*>.*?background-image: url\(([^)]+)\);".*?<span class="sr-only">(.*?)<\/span>.*?<div class="course-category">\s*([^<]+)<\/div>.*?<div class="course-summary">.*?<p>(.*?)<\/p>/g;
// while ((match = courseRegex.exec(cleanHtml)) !== null) {
// allCourses.push({
// category: match[4].trim(),
// link: match[1].trim(),
// image: match[2].trim(),
// name: match[3].trim(),
// description: match[5].replace(/<br\s*\/?>/g, ' ').trim()
// });
// }
// }
const allCourses = [
{
category: "Software Development & Engineering",
link: "https://kodepilot.in/course/view.php?id=16",
image: "https://kodepilot.in/pluginfile.php/53/course/overviewfiles/UiUx.png",
name: "UI/UX Design",
description: "Learn the fundamentals of user interface and user experience design."
},
{
category: "Software Development & Engineering",
link: "https://kodepilot.in/course/view.php?id=9",
image: "https://kodepilot.in/pluginfile.php/39/course/overviewfiles/IOS.png",
name: "iOS Development",
description: "Build iOS apps using Swift and Apples development tools."
},
{
category: "Software Development & Engineering",
link: "https://kodepilot.in/course/view.php?id=7",
image: "https://kodepilot.in/pluginfile.php/35/course/overviewfiles/RD.png",
name: "React Development",
description: "Master React.js for building fast and scalable web apps."
},
{
category: "Software Development & Engineering",
link: "https://kodepilot.in/course/view.php?id=5",
image: "https://kodepilot.in/pluginfile.php/31/course/overviewfiles/PFS.png",
name: "Full Stack Development",
description: "End-to-end training in frontend, backend, and databases."
},
{
category: "Software Development & Engineering",
link: "https://kodepilot.in/course/view.php?id=3",
image: "https://kodepilot.in/pluginfile.php/25/course/overviewfiles/JFS.png",
name: "Java Full Stack",
description: "Become a full stack developer with Java, Spring, and modern tools."
},
{
category: "Quality & Testing",
link: "https://kodepilot.in/course/view.php?id=13",
image: "https://kodepilot.in/pluginfile.php/46/course/overviewfiles/PT.png",
name: "Performance Testing",
description: "Learn tools and techniques for testing system performance."
},
{
category: "Quality & Testing",
link: "https://kodepilot.in/course/view.php?id=10",
image: "https://kodepilot.in/pluginfile.php/41/course/overviewfiles/QA.png",
name: "QA Testing",
description: "Understand quality assurance practices for reliable software."
},
{
category: "Cloud & DevOps",
link: "https://kodepilot.in/course/view.php?id=17",
image: "https://kodepilot.in/pluginfile.php/55/course/overviewfiles/GC.png",
name: "Google Cloud",
description: "Get hands-on with Google Cloud Platform services and tools."
},
{
category: "Cloud & DevOps",
link: "https://kodepilot.in/course/view.php?id=4",
image: "https://kodepilot.in/pluginfile.php/28/course/overviewfiles/AWSA.png",
name: "AWS Associate",
description: "Prepare for AWS certifications and cloud computing skills."
},
{
category: "AI, Data & Emerging Tech (On-demand & trending)",
link: "https://kodepilot.in/course/view.php?id=26",
image: "https://kodepilot.in/pluginfile.php/73/course/overviewfiles/DE.png",
name: "Data Engineering",
description: "Build pipelines and manage data at scale for analytics."
},
{
category: "AI, Data & Emerging Tech (On-demand & trending)",
link: "https://kodepilot.in/course/view.php?id=18",
image: "https://kodepilot.in/pluginfile.php/58/course/overviewfiles/PE.png",
name: "Prompt Engineering",
description: "Learn to design prompts for AI models like ChatGPT."
},
{
category: "AI, Data & Emerging Tech (On-demand & trending)",
link: "https://kodepilot.in/course/view.php?id=12",
image: "https://kodepilot.in/pluginfile.php/44/course/overviewfiles/AI%28Ess%29.png",
name: "AI Essentials",
description: "Introduction to AI, ML concepts, and real-world use cases."
},
{
category: "Enterprise & Business Tech",
link: "https://kodepilot.in/course/view.php?id=24",
image: "https://kodepilot.in/pluginfile.php/70/course/overviewfiles/ServiceNow.png",
name: "ServiceNow",
description: "Learn ITSM and workflow automation with ServiceNow."
},
{
category: "Enterprise & Business Tech",
link: "https://kodepilot.in/course/view.php?id=19",
image: "https://kodepilot.in/pluginfile.php/61/course/overviewfiles/SAP.png",
name: "SAP",
description: "Master SAP ERP modules for enterprise solutions."
},
{
category: "Cybersecurity & Compliance",
link: "https://kodepilot.in/course/view.php?id=23",
image: "https://kodepilot.in/pluginfile.php/69/course/overviewfiles/Security.png",
name: "Security Fundamentals",
description: "Understand core concepts of IT security and defense."
},
{
category: "Cybersecurity & Compliance",
link: "https://kodepilot.in/course/view.php?id=22",
image: "https://kodepilot.in/pluginfile.php/68/course/overviewfiles/CyE.png",
name: "Cyber Essentials",
description: "Learn the basics of cybersecurity and compliance standards."
while ((match = courseRegex.exec(cleanHtml)) !== null) {
allCourses.push({
category: match[4].trim(),
link: match[1].trim(),
image: match[2].trim(),
name: match[3].trim(),
description: match[5].replace(/<br\s*\/?>/g, ' ').trim()
});
}
];
}
// const allCourses = [
// {
// category: "Software Development & Engineering",
// link: "https://kodepilot.in/course/view.php?id=16",
// image: "https://kodepilot.in/pluginfile.php/53/course/overviewfiles/UiUx.png",
// name: "UI/UX Design",
// description: "Learn the fundamentals of user interface and user experience design."
// },
// {
// category: "Software Development & Engineering",
// link: "https://kodepilot.in/course/view.php?id=9",
// image: "https://kodepilot.in/pluginfile.php/39/course/overviewfiles/IOS.png",
// name: "iOS Development",
// description: "Build iOS apps using Swift and Apples development tools."
// },
// {
// category: "Software Development & Engineering",
// link: "https://kodepilot.in/course/view.php?id=7",
// image: "https://kodepilot.in/pluginfile.php/35/course/overviewfiles/RD.png",
// name: "React Development",
// description: "Master React.js for building fast and scalable web apps."
// },
// {
// category: "Software Development & Engineering",
// link: "https://kodepilot.in/course/view.php?id=5",
// image: "https://kodepilot.in/pluginfile.php/31/course/overviewfiles/PFS.png",
// name: "Full Stack Development",
// description: "End-to-end training in frontend, backend, and databases."
// },
// {
// category: "Software Development & Engineering",
// link: "https://kodepilot.in/course/view.php?id=3",
// image: "https://kodepilot.in/pluginfile.php/25/course/overviewfiles/JFS.png",
// name: "Java Full Stack",
// description: "Become a full stack developer with Java, Spring, and modern tools."
// },
// {
// category: "Quality & Testing",
// link: "https://kodepilot.in/course/view.php?id=13",
// image: "https://kodepilot.in/pluginfile.php/46/course/overviewfiles/PT.png",
// name: "Performance Testing",
// description: "Learn tools and techniques for testing system performance."
// },
// {
// category: "Quality & Testing",
// link: "https://kodepilot.in/course/view.php?id=10",
// image: "https://kodepilot.in/pluginfile.php/41/course/overviewfiles/QA.png",
// name: "QA Testing",
// description: "Understand quality assurance practices for reliable software."
// },
// {
// category: "Cloud & DevOps",
// link: "https://kodepilot.in/course/view.php?id=17",
// image: "https://kodepilot.in/pluginfile.php/55/course/overviewfiles/GC.png",
// name: "Google Cloud",
// description: "Get hands-on with Google Cloud Platform services and tools."
// },
// {
// category: "Cloud & DevOps",
// link: "https://kodepilot.in/course/view.php?id=4",
// image: "https://kodepilot.in/pluginfile.php/28/course/overviewfiles/AWSA.png",
// name: "AWS Associate",
// description: "Prepare for AWS certifications and cloud computing skills."
// },
// {
// category: "AI, Data & Emerging Tech (On-demand & trending)",
// link: "https://kodepilot.in/course/view.php?id=26",
// image: "https://kodepilot.in/pluginfile.php/73/course/overviewfiles/DE.png",
// name: "Data Engineering",
// description: "Build pipelines and manage data at scale for analytics."
// },
// {
// category: "AI, Data & Emerging Tech (On-demand & trending)",
// link: "https://kodepilot.in/course/view.php?id=18",
// image: "https://kodepilot.in/pluginfile.php/58/course/overviewfiles/PE.png",
// name: "Prompt Engineering",
// description: "Learn to design prompts for AI models like ChatGPT."
// },
// {
// category: "AI, Data & Emerging Tech (On-demand & trending)",
// link: "https://kodepilot.in/course/view.php?id=12",
// image: "https://kodepilot.in/pluginfile.php/44/course/overviewfiles/AI%28Ess%29.png",
// name: "AI Essentials",
// description: "Introduction to AI, ML concepts, and real-world use cases."
// },
// {
// category: "Enterprise & Business Tech",
// link: "https://kodepilot.in/course/view.php?id=24",
// image: "https://kodepilot.in/pluginfile.php/70/course/overviewfiles/ServiceNow.png",
// name: "ServiceNow",
// description: "Learn ITSM and workflow automation with ServiceNow."
// },
// {
// category: "Enterprise & Business Tech",
// link: "https://kodepilot.in/course/view.php?id=19",
// image: "https://kodepilot.in/pluginfile.php/61/course/overviewfiles/SAP.png",
// name: "SAP",
// description: "Master SAP ERP modules for enterprise solutions."
// },
// {
// category: "Cybersecurity & Compliance",
// link: "https://kodepilot.in/course/view.php?id=23",
// image: "https://kodepilot.in/pluginfile.php/69/course/overviewfiles/Security.png",
// name: "Security Fundamentals",
// description: "Understand core concepts of IT security and defense."
// },
// {
// category: "Cybersecurity & Compliance",
// link: "https://kodepilot.in/course/view.php?id=22",
// image: "https://kodepilot.in/pluginfile.php/68/course/overviewfiles/CyE.png",
// name: "Cyber Essentials",
// description: "Learn the basics of cybersecurity and compliance standards."
// }
// ];
console.table(allCourses);