Skip to content

Instantly share code, notes, and snippets.

@wybiral
Created June 13, 2019 23:12
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 wybiral/deafa5fc11925d3e7d8f7f4c6bf3b9ab to your computer and use it in GitHub Desktop.
Save wybiral/deafa5fc11925d3e7d8f7f4c6bf3b9ab to your computer and use it in GitHub Desktop.
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}
body {
background: #000;
}
img {
max-height: 100px;
}
</style>
<script>
window.onload = () => {
const ws = new WebSocket('ws://localhost:8080');
ws.onmessage = evt => {
const obj = JSON.parse(evt.data);
obj.images.forEach(src => {
const a = document.createElement('a');
const img = document.createElement('img');
img.src = src;
a.target = '_blank';
a.href = 'https://twitter.com/a/status/' + obj.tweet_id;
a.appendChild(img);
document.body.appendChild(a);
});
};
};
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment