Skip to content

Instantly share code, notes, and snippets.

@SKaplanOfficial
Created August 29, 2022 07:29
Show Gist options
  • Save SKaplanOfficial/321b1fcbab713b4c6dab2dbbb782a86b to your computer and use it in GitHub Desktop.
Save SKaplanOfficial/321b1fcbab713b4c6dab2dbbb782a86b to your computer and use it in GitHub Desktop.
Play the previews for the top 10 songs on iTunes parsed from Apple's RSS feed using PyXA
import PyXA
reader = PyXA.RSSFeed("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml")
links = reader.items().links()
m4as = filter(lambda x: "m4a" in x.url, links)
for index, song in enumerate(m4as):
print("Now playing: " + reader.items()[index].title)
sound = PyXA.XASound(song)
sound.play()
sleep(sound.duration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment