Skip to content

Instantly share code, notes, and snippets.

@nazimamin
Created June 16, 2017 00:41
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 nazimamin/600c983764260f260141fc56c1e2d229 to your computer and use it in GitHub Desktop.
Save nazimamin/600c983764260f260141fc56c1e2d229 to your computer and use it in GitHub Desktop.
//get quotes fro https://worldhistoryproject.org/topics/mahatma-gandhi
var items = document.getElementsByClassName("media-list")[0].children;
for (var item in items) {
var time = item.children[0].textContent;
var mediaHeading = item.children[1].children[1].children[0].innerText;
var link = item.children[1].children[1].children[0].getAttribute("href");
const output = `<li>
<a href="https://worldhistoryproject.org${link}">
<b>${time.trim()}</b> - ${mediaHeading}.
</a>
</li>`;
console.log(output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment