Skip to content

Instantly share code, notes, and snippets.

@yucedagonurcan
Created May 5, 2019 20:22
Show Gist options
  • Select an option

  • Save yucedagonurcan/266c84ccc44391fc5e3936ef6329241f to your computer and use it in GitHub Desktop.

Select an option

Save yucedagonurcan/266c84ccc44391fc5e3936ef6329241f to your computer and use it in GitHub Desktop.
function exportToJsonFile(jsonData) {
let dataStr = JSON.stringify(jsonData);
let dataUri =
"data:application/json;charset=utf-8," + encodeURIComponent(dataStr);
let exportFileDefaultName = "data.json";
let linkElement = document.createElement("a");
linkElement.setAttribute("href", dataUri);
linkElement.setAttribute("download", exportFileDefaultName);
linkElement.click();
}
var items = $(
"body > div.container > div > div.infinite-container.text-center"
);
var dates = [];
Array.from(items[0].children).forEach(element => {
var date = $(element)
.find("div.stars-accumulated.text-center")
.text();
if (date == "") {
console.log(`Item is not found ${element}`);
} else {
dates.push(date.trim());
}
});
parsed_dates = dates.map(element => {
parsed_date = element.split(" ");
return {
day: parsed_date[0],
month: parsed_date[1],
year: parsed_date[2]
};
});
exportToJsonFile(parsed_dates);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment