'How to play song from Spotify using Python
All questions about this topic are outdated and left unanswered. There is no answer and I am trying to create a music app that uses Spotify to search songs and then play the first related song. How do I can achieve this? Is there any module about that topic?
I found a script that uses Selenium to achieve the solution but it doesn't help me so much.
If this is not achievable, is there such a method for YouTube? Like search the song name and get the first related song (or video).
I hope you can give me an answer. Have a good day.
Solution 1:[1]
try using https://pypi.org/project/pyspotify/ refer the documentation for more information https://pyspotify.readthedocs.io/en/latest/ Hope this helps u Thank you
Solution 2:[2]
have you had i look at spotipy to access Spotify Web Api##
Spotify's Web API only supports 30 second clips,You can do playback of the full track using the mobile SDKs
Solution 3:[3]
Actually there is such a method for YouTube. There is a module named "pywhatkit".
It is actually a WhatsApp server but you can use it to play music on YouTube. First install it using pip install pywhatkit then :
import pywhatkit
songOrArtist = input()
pywhatkit.playonyt(songOrArtist)
This will open the desired song, you can also give name of any artist and it can play the song.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | |
| Solution 3 | Swarnava Bose |
