Initial commit

This commit is contained in:
Logan Williams
2020-09-10 10:13:51 -07:00
commit 3641525cc8
2 changed files with 73 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.DS_Store

71
index.html Normal file
View File

@@ -0,0 +1,71 @@
<html>
<head>
<title>Tiktok date extractor</title>
<script src="https://unpkg.com/dayjs"></script>
<script src="https://unpkg.com/dayjs-plugin-utc"></script>
<script>
dayjs.extend(dayjsPluginUTC.default);
</script>
<style>
body {
margin: 1em;
font-family: "Helvetica", Arial, sans-serif;
font-size: 18px;
}
button, input {
font-size: 16px;
}
.form {
margin-bottom: 1em;
}
</style>
</head>
<body>
<script>
function getdate() {
document.getElementById("date").innerHTML = "...";
document.getElementById("label").innerHTML = "Uploaded on: ";
var url = document.getElementById("url").value;
var headers = {
Origin: "https://www.tiktok.com",
Accept:
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"User-Agent":
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15",
"Accept-Language": "en-us",
Connection: "keep-alive",
};
resp = fetch("https://cors-anywhere.herokuapp.com/" + url, {
method: "GET",
headers: headers,
})
.then(function (r) {
return r.text();
})
.then(function (text) {
var split = text.split(`"createTime":"`);
split = split[1].split(`"`);
var formatted = dayjs
.utc(+split[0] * 1000)
.format("MMM D YYYY, HH:mm:ss UTC");
document.getElementById("date").innerHTML = formatted;
});
}
</script>
<div class="form">
<label for="url">Tiktok video URL:</label>
<input type="text" id="url" name="url" />
<button onclick="getdate()">Get uploaded date</button>
</div>
<div class="output"><span id="label">Uploaded on: </span><span class="date" id="date"></span></div>
</body>
</html>