1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Shazam からなうぷれ共有ブックマークレット

Last updated at Posted at 2018-03-11

Mac の Shazam アプリ

最近これを使い始めて、ブラウザプレイヤーだろうと動画のオープニングだろうとひっくるめて曲を検知してくれるので能動的 siri な感じで楽しいです。
(回し者ではないです。)

「Shazam - 音楽認識」をMac App Storeで

Item-0_and_Item-0_and_Item-0.png

アプリで飛んだリンクから共有

Shazam のページ で使う共有用のブックマークレットを作りました。

実は普通に公式のシェアボタンがあります。
しかし、なぷれうツイートとしてカスタマイズして共有したかったのでブックマークレットにしました。

ブックマークレット

javascript: (() => {
  const songTitle = document.title.replace(' | Shazam', '');
  const url = encodeURIComponent(window.location.href);
  const text = encodeURIComponent(`♫['w'] > ${songTitle}`);
  const hashtags = 'NowPlaying';
  const params = { url, text, hashtags };
  const query = Object.entries(params)
    .map((kv) => kv.join('='))
    .join('&');
  const shareUrl = `https://twitter.com/intent/tweet?` + query;
  window.open(shareUrl, '', 'width=550, height=420');
})();

下のようにウィンドウが開きます。

Twitter_でリンクを共有する_and_tweet-shazam-nowplaying_js_—____ghq_github_com_elzup_bookmarklets.png

その他

ブックマークレットの使いかたなど
ブックマークレット活用・すばやい登録と呼び出し - Qiita

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?