Skip to content
Discussion options

You must be logged in to vote

Добавьте функцию shazamToSpotify_ в проект (в новый файл или существующий для аддонов).

function shazamToSpotify_(path) {
  let url = `https://www.shazam.com/services/charts/csv/${path}`;
  let text = CustomUrlFetchApp.fetch(url).getContentText();
  let csvStr = text.split('\n').slice(2);
  let keys = csvStr.splice(0, 1)[0].split(',');
  let shazamTracks = csvStr.reduce((array, str) => {
    let items = str.split(',');
    let obj = keys.reduce((obj, key, i) => {
      obj[key.toLowerCase()] = items[i].formatName().replace(/"/g, '');
      return obj;
    }, {});
    array.push(obj);
    return array;
  }, []);
  return Search.multisearchTracks(shazamTracks, (item) => `${item.artist} ${item.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Maracumba
Comment options

Comment options

You must be logged in to vote
1 reply
@Maracumba
Comment options

Answer selected by Chimildic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #160 on December 22, 2021 14:26.