Update get cover art from itunes cause CORS problem. #1

Merged
PeWe79 merged 2 commits from main into main 2024-12-26 21:38:11 +03:00
PeWe79 commented 2024-12-26 19:30:31 +03:00 (Migrated from github.com)

New methods get cover art from itunes because CORS problem when on mobile device (iOS).

New methods get cover art from itunes because CORS problem when on mobile device (iOS).
gAlleb commented 2024-12-26 20:06:29 +03:00 (Migrated from github.com)

Thanks @PeWe79! And for cleaning the code)

Yeah, an old problem. But I've noticed that changing User-Agent works that's why it looks strange)

          headers: {
            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15'
          }

However, the 'returns' contain artist, title... and no collectionViewUrl in case of failure

        if (response.status === 403) {
        const results = {
          title: title,
          artist: artist,
          artworkUrl: coverArt,
        }
        return results
      }

      const data = response.ok ? await response.json() : {}
      if (!data.results || data.results.length === 0) {
        const results = {
          title: title,
          artist: artist,
          artworkUrl: coverArt,
        }
        return results
      }

Am I getting something wrong?

Thanks @PeWe79! And for cleaning the code) Yeah, an old problem. But I've noticed that changing User-Agent works that's why it looks strange) ``` headers: { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15' } ``` However, the 'returns' contain `artist, title...` and no `collectionViewUrl` in case of failure ``` if (response.status === 403) { const results = { title: title, artist: artist, artworkUrl: coverArt, } return results } const data = response.ok ? await response.json() : {} if (!data.results || data.results.length === 0) { const results = { title: title, artist: artist, artworkUrl: coverArt, } return results } ``` Am I getting something wrong?
PeWe79 commented 2024-12-26 20:20:15 +03:00 (Migrated from github.com)

Hi @gAlleb thats can be return collectionViewUrl also. But just an temporary, cause no request from metadata coming. But response from iTunes can be return many data.

Hi @gAlleb thats can be return `collectionViewUrl` also. But just an temporary, cause no request from metadata coming. But response from iTunes can be return many data.
PeWe79 commented 2024-12-26 20:25:23 +03:00 (Migrated from github.com)

However, if return collectionViewUrl is failure, maybe can be use # 😊

However, if return `collectionViewUrl` is failure, maybe can be use `#` :blush:
gAlleb commented 2024-12-26 21:40:05 +03:00 (Migrated from github.com)

Thanks! Made some minor changes.

Thanks! Made some minor changes.
Sign in to join this conversation.
No description provided.