Skip to content

Instantly share code, notes, and snippets.

@wsrast
Last active May 2, 2019 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wsrast/bcb6fcf7eb24f991725308b39edd60ba to your computer and use it in GitHub Desktop.
Save wsrast/bcb6fcf7eb24f991725308b39edd60ba to your computer and use it in GitHub Desktop.
Bitbucket web page scraper for repositories
JSON.stringify(Array.from(document.querySelectorAll('[data-repository-id]')).map(aTag => {
const href = aTag.getAttribute('href');
let projName = href.match(/\/projects\/(.+)\/repos/)[1].toLowerCase();
let repoName = href.match(/\/repos\/(.+)\/browse/)[1];
repoName = repoName.replace(' ', '-');
const templ = `https://${location.host}/scm/${projName}/${repoName}.git`;
return {
href,
name: aTag.innerText,
clone: templ
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment