Skip to content

Instantly share code, notes, and snippets.

@skeptrunedev
Created March 1, 2024 05:28
Show Gist options
  • Save skeptrunedev/5dedd1bc19c108eb6a33a32b75f98122 to your computer and use it in GitHub Desktop.
Save skeptrunedev/5dedd1bc19c108eb6a33a32b75f98122 to your computer and use it in GitHub Desktop.
obsidian plugin scrape
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