Created
March 1, 2024 05:28
-
-
Save skeptrunedev/5dedd1bc19c108eb6a33a32b75f98122 to your computer and use it in GitHub Desktop.
obsidian plugin scrape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pluginsArray = []; | |
const pluginContainers = document.querySelectorAll('.p-5.flex.flex-col.rounded-lg.bg-secondary.transition-all.hover\\:shadow-2xl.hover\\:bg-gray-800'); | |
pluginContainers.forEach((container) => { | |
const title = container.querySelector('.text-lg.mb-1.font-semibold.leading-tight')?.innerText.trim() || 'No title'; | |
const authorNameElement = container.querySelectorAll('.text-muted.text-sm')[0]; | |
const author_name = authorNameElement ? authorNameElement.innerText.trim() : 'Unknown Author'; | |
const numDownloadsElement = container.querySelectorAll('.text-muted.text-sm')[1]; | |
const num_downloads = numDownloadsElement ? numDownloadsElement.innerText.trim() : 'No downloads information'; | |
const descriptionElement = container.querySelector('.py-3.leading-tight'); | |
const description = descriptionElement ? descriptionElement.innerText.trim() : 'No description available'; | |
const learnMoreElement = container.querySelector('a[href*="github.com"]'); | |
const learn_more_link = learnMoreElement ? learnMoreElement.href : 'No link'; | |
pluginsArray.push({ title, author_name, num_downloads, description, learn_more_link }); | |
}); | |
console.log(pluginsArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment