Skip to content

Instantly share code, notes, and snippets.

@g2p
Forked from hennzen/export-shazam-web.js
Last active January 21, 2023 14:41
Show Gist options
  • Select an option

  • Save g2p/1e45df5c70a22e2c01edc91978d56896 to your computer and use it in GitHub Desktop.

Select an option

Save g2p/1e45df5c70a22e2c01edc91978d56896 to your computer and use it in GitHub Desktop.

Revisions

  1. g2p revised this gist Mar 11, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion export-shazam-web.js
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ copy ({
    scriptRevision: "0.0.3",
    listCreated: new Date().toISOString()
    },
    shazamItems: Array.from(document.querySelectorAll('.shazams-content ul.panel-bd.panel-bd-wide'))
    shazamItems: Array.from(document.querySelectorAll('.shazams-content ul.panel-bd.panel-bd-wide .track'))
    .reverse() // delete this line for date descending order
    .map((item, index) => ({
    no: index + 1,
  2. @hennzen hennzen revised this gist Sep 27, 2020. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions export-shazam-web.js
    Original file line number Diff line number Diff line change
    @@ -12,30 +12,32 @@
    // {
    // "meta": {
    // "scriptUrl": "https://gist.github.com/hennzen/dc2b7bb76ce5507063f6c5e60c68886a",
    // "scriptRevision": "0.0.2",
    // "scriptRevision": "0.0.3",
    // "listCreated": "2020-09-27T07:40:06.184Z"
    // },
    // "shazamItems": [
    // {
    // "no": 1,
    // "title": "Dancing With The Damned",
    // "artist": "Killing Mood",
    // "cover": "https://images.shazam.com/coverart/t50270807-b333557118_s400.jpg"
    // "cover": "https://images.shazam.com/coverart/t50270807-b333557118_s400.jpg",
    // "availableOnAppleMusicPlay": true
    // }
    // ]
    // }
    copy ({
    meta: {
    scriptUrl: "https://gist.github.com/hennzen/dc2b7bb76ce5507063f6c5e60c68886a",
    scriptRevision: "0.0.2",
    scriptRevision: "0.0.3",
    listCreated: new Date().toISOString()
    },
    shazamItems: Array.from(document.querySelectorAll('.shazams-content ul.panel-bd.panel-bd-wide'))
    .reverse() // delete this line for date descending order
    .map((item, index) => ({
    no: index+1,
    no: index + 1,
    title: item.querySelector('.title').innerText,
    artist: item.querySelector('.artist').innerText,
    cover: item.querySelector('.image.album-art').style['background-image'].match(/"(.*?)"/)[1]
    cover: item.querySelector('.image.album-art').style['background-image'].match(/"(.*?)"/)[1],
    availableOnAppleMusicPlay: item.querySelector('article').getAttribute("data-shz-applemusicplay-id").length ? true: false
    }))
    });
  3. @hennzen hennzen revised this gist Sep 27, 2020. 1 changed file with 23 additions and 11 deletions.
    34 changes: 23 additions & 11 deletions export-shazam-web.js
    Original file line number Diff line number Diff line change
    @@ -9,21 +9,33 @@
    // 5. Paste the result to your favorite text editor. Voilà.

    // Output JSON looks like
    // [
    // {
    // "no": 1,
    // "title": "Dancing With The Damned",
    // "artist": "Killing Mood",
    // "cover": "https://images.shazam.com/coverart/t50270807-b333557118_s400.jpg"
    // }
    // ]
    copy(
    $$('ul.panel-bd.panel-bd-wide')
    // {
    // "meta": {
    // "scriptUrl": "https://gist.github.com/hennzen/dc2b7bb76ce5507063f6c5e60c68886a",
    // "scriptRevision": "0.0.2",
    // "listCreated": "2020-09-27T07:40:06.184Z"
    // },
    // "shazamItems": [
    // {
    // "no": 1,
    // "title": "Dancing With The Damned",
    // "artist": "Killing Mood",
    // "cover": "https://images.shazam.com/coverart/t50270807-b333557118_s400.jpg"
    // }
    // ]
    // }
    copy ({
    meta: {
    scriptUrl: "https://gist.github.com/hennzen/dc2b7bb76ce5507063f6c5e60c68886a",
    scriptRevision: "0.0.2",
    listCreated: new Date().toISOString()
    },
    shazamItems: Array.from(document.querySelectorAll('.shazams-content ul.panel-bd.panel-bd-wide'))
    .reverse() // delete this line for date descending order
    .map((item, index) => ({
    no: index+1,
    title: item.querySelector('.title').innerText,
    artist: item.querySelector('.artist').innerText,
    cover: item.querySelector('.image.album-art').style['background-image'].match(/"(.*?)"/)[1]
    }))
    )
    });
  4. @hennzen hennzen revised this gist Sep 26, 2020. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions export-shazam-web.js
    Original file line number Diff line number Diff line change
    @@ -19,11 +19,11 @@
    // ]
    copy(
    $$('ul.panel-bd.panel-bd-wide')
    .reverse() // delete this line for date descending order
    .map((item, index) => ({
    no: index+1,
    title: item.querySelector('.title').innerText,
    artist: item.querySelector('.artist').innerText,
    cover: item.querySelector('.image.album-art').style['background-image'].match(/"(.*?)"/)[1]
    }))
    .reverse() // delete this line for date descending order
    .map((item, index) => ({
    no: index+1,
    title: item.querySelector('.title').innerText,
    artist: item.querySelector('.artist').innerText,
    cover: item.querySelector('.image.album-art').style['background-image'].match(/"(.*?)"/)[1]
    }))
    )
  5. @hennzen hennzen revised this gist Sep 26, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion export-shazam-web.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    // Order of results is in ascending date order. If you want to change that, delete line with '.reverse()'
    // The result is copied to your clipboard
    //
    // 1. Open https://www.shazam.com/de/myshazam and login
    // 1. Open https://www.shazam.com/myshazam and login
    // 2. Scroll down to the end of your list, so that *all* songs are loaded
    // 3. Open Developer console with F12
    // 4. Copy paste this code to the JS-console and hit Enter
  6. @hennzen hennzen created this gist Sep 26, 2020.
    29 changes: 29 additions & 0 deletions export-shazam-web.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    // JS-Console script to export song name, artist and cover image URL to a JSON format
    // Order of results is in ascending date order. If you want to change that, delete line with '.reverse()'
    // The result is copied to your clipboard
    //
    // 1. Open https://www.shazam.com/de/myshazam and login
    // 2. Scroll down to the end of your list, so that *all* songs are loaded
    // 3. Open Developer console with F12
    // 4. Copy paste this code to the JS-console and hit Enter
    // 5. Paste the result to your favorite text editor. Voilà.

    // Output JSON looks like
    // [
    // {
    // "no": 1,
    // "title": "Dancing With The Damned",
    // "artist": "Killing Mood",
    // "cover": "https://images.shazam.com/coverart/t50270807-b333557118_s400.jpg"
    // }
    // ]
    copy(
    $$('ul.panel-bd.panel-bd-wide')
    .reverse() // delete this line for date descending order
    .map((item, index) => ({
    no: index+1,
    title: item.querySelector('.title').innerText,
    artist: item.querySelector('.artist').innerText,
    cover: item.querySelector('.image.album-art').style['background-image'].match(/"(.*?)"/)[1]
    }))
    )