Skip to content

Instantly share code, notes, and snippets.

@woxtu
Last active October 9, 2022 14:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woxtu/6b214ea9cef53e246beb9fc31c5295fe to your computer and use it in GitHub Desktop.
Save woxtu/6b214ea9cef53e246beb9fc31c5295fe to your computer and use it in GitHub Desktop.
Qiitadon 新着 読み上げ ブックマークレット
(() => {
ws = new WebSocket("wss://streaming.qiitadon.com:4000/api/v1/streaming/?stream=public:local");
ws.addEventListener("message", (ev) => {
const { event, payload } = JSON.parse(ev.data);
if (event === "update") {
const status = JSON.parse(payload);
speechSynthesis.cancel();
speechSynthesis.speak(new SpeechSynthesisUtterance(status.account.display_name || status.account.username));
speechSynthesis.speak(new SpeechSynthesisUtterance(status.content.replace(/<\/?[^>]+(>|$)/g, "")));
}
});
})()
@woxtu
Copy link
Author

woxtu commented Jul 7, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment