Skip to content

Commit

Permalink
web and overridejs to manually correct things
Browse files Browse the repository at this point in the history
  • Loading branch information
kiawildberger committed Apr 6, 2021
1 parent 6357c46 commit c49ccaf
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/node_modules
/index.html
/index.js
/config.json
7 changes: 5 additions & 2 deletions fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ let npt, arr = {}, second = 1, fpt="no"
let badarray = {}

let ratingreg = new RegExp(/.+\/10/) // smh he had to ruin my beautiful regex because sometimes its not a definitive score (CLASSIC/:triumph:/etc)
let normalreg = new RegExp(/[a-zA-Z0-9]{0,10}\/10/)
let normalreg = new RegExp(/[0-9]{0,10}\/10/)

async function getPlayListItems(pid, npt=null) {
if(npt === fpt) { // the current page token is the first one
console.log("finished!")
require("./override.js")
return;
}

Expand All @@ -33,6 +34,8 @@ async function getPlayListItems(pid, npt=null) {
a.snippet.title.includes("EP REVIEW")) {
let r = a.snippet.description.match(normalreg) // this is just numbers
let alsocouldbe = a.snippet.description.match(ratingreg) // wack
if(r && r[0] === "/10") r[0] = alsocouldbe
if(a.snippet.description.toLowerCase().includes("classic/10")) r = "classic/10"
// if(r) console.log(r[0].replace('\\n').trim())
let q = a.snippet.title.split("-"), artist, album;
if(!q[1] || !q[0]) {
Expand All @@ -59,7 +62,7 @@ async function getPlayListItems(pid, npt=null) {
}
arr[a.snippet.resourceId.videoId] = { // https://google.com/search?q=javascript+remove+duplicates+from+array
title: a.snippet.title,
rating: r || "???",
rating: r || "???/10",
album: album,
artist: artist,
date: date,
Expand Down
26 changes: 26 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<head>
<title>TheNeedleDrop Review Scores</title>
</head>
<body>
<div align="center">
<div class="text">
This is a list of all of Anthony Fantano's album reviews &mdash; though I'm sure I'm missing some &mdash; made easily searchable and sortable by score, upload date, and name. Dates and times are most likely in UTC.
</div>
<table id="table">
<tr>
<th>Video</th>
<th>Album</th>
<th>Artist</th>
<th>Score</th>
<th>Date</th>
</tr>
<tr>

</tr>
</table>
</div>
<style>

</style>
<script src="index.js"></script>
</body>
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let table = document.getElementById('table')
async function populate() {
let data = await fetch("https://raw.githubusercontent.com/kiawildberger/sadtano-sort/master/result.json")
let json = await data.json()
for(i in json) { // huge
let tr = document.createElement("tr")
i = json[i]
tr.innerHTML = `<td><a href="https://youtube.com/watch?v=${i.id}" target="_blank"><img src="${i.thumb}"</a></td>
<td>${i.album}</td>
<td>${i.artist}</td>
<td>${i.rating[0]}</td>
<td>${i.nicedate}</td>`
table.appendChild(tr)
}
}

populate()
9 changes: 9 additions & 0 deletions override.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(function() {
const fs = require("fs")
let data = JSON.parse(fs.readFileSync("./result.json"))
function set(id, key, value) { if(data[id] && data[id][key]) data[id][key] = value; }

set("JX54Kz7DaZQ", "rating", "7/10")

fs.writeFileSync("./result.json", JSON.stringify(data))
})();
2 changes: 1 addition & 1 deletion result.json

Large diffs are not rendered by default.

0 comments on commit c49ccaf

Please sign in to comment.