Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1309, #1451 Fixes missing title and cover for spotify playlists by adding user-agent #1692

Conversation

mbaumeler
Copy link

@mbaumeler mbaumeler commented Dec 30, 2021

Spotify returns a bad request when no user-agent is given.

Simple way to reproduce:

<?php
// demo code to reproduce:
$headers = stream_context_create(array('http'=>array('method'=>'GET', 'header'=>'user-agent:Phoniebox')));
$url = "https://open.spotify.com/oembed?url=spotify:playlist:4wFsylSpjoor3HXkle80sa&format=json";

echo "This will work:\n";
echo file_get_contents($url, false, $headers);

echo "\n\nThis will fail (400 Bad Request):\n";
echo file_get_contents($url);
?>

Therefore I added a simple user-agent to all spotify requests. It is similar and inspired by the solution of @acidburn78 but without adding a new dependency.

@mbaumeler mbaumeler changed the title #1309, #1451, #1691 Add user-agent to avoid 400-bad-requests #1309, #1451 Fixes missing title and cover for spotify playlists by adding user-agent Jan 17, 2022
@MiczFlor MiczFlor merged commit 585e0a8 into MiczFlor:develop Feb 27, 2022
@s-martin s-martin linked an issue May 31, 2022 that may be closed by this pull request
@s-martin s-martin added this to the 2.4 milestone May 31, 2022
@s-martin s-martin linked an issue May 31, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No cover displayed from Spotify in web GUI🐛 Spotify Playlist Titles not Showing in App Player
4 participants