Hey guys,
welcome to Day 46 of 100 Days of Code. Today
we've got a pretty special project for you.
It's a musical time machine project. So what does that mean?
Well,
recently I received a mixed tape from a friend and the mix tape contained all of
the top songs from the period of time when we went to school together.
And it was a really, really beautiful gift
and it was a really nice way of jogging your memories for that particular time
point in your life. This got me thinking,
and I thought about how music can take you back into a particular time in your
life as if it just transported you. By listening to the same songs that were hits
during that period of time
it was like as if I was being transported back and could relive a moment in my
childhood. And you might have the same experience.
Maybe there's certain songs that were really popular in your childhood that
brings back memories, or maybe for a particular relationship,
or maybe a holiday that you went on. Trying to jog these memories by using music
is a really,
really fantastic way of reminiscing and savoring some of your favorite moments
in time.
So what we're going to be building today is a Python time machine,
not the sort of time machine that might take a human back in time,
but it will go back in time to find the music that was in the top 100 shots that
was being played all over the radio so that you can relive that period of time
once more through music. Billboard
compiles a list of the top 100 songs.
So these are the most played songs during a particular week.
And if you go to chart/hot-100, you'll see it for the current week,
but there's also a feature where you can change the date to any data in the past
20 years.
So if we select a random date in year 2000,
you can see that the songs that come up here, and it depends on your age
but some of these artists
you might have never heard of like N Sync or Destiny's child or Vertical
Horizon. But if you listen to these tracks in order,
then it will be almost like you've been transported back to year 2000,
August 12 and you're just listening to the things on the radio.
This is how we are going to approach this task. First,
we're going to use Beautiful Soup to scrape the top 100 songs from a particular
date of your choice.
And then we're going to extract all of the song titles from the list,
and then we're going to use the Spotify API to create a playlist for that
particular date.
And we're going to see right through Spotify for each of the songs and add
those songs to our new playlist. So that by the end of this whole process,
we end up with a playlist that has the top 100 songs for a particular date in
the past.
So if you've got an anniversary coming up or a birthday coming up,
this might just be the perfect present where you create a playlist of the
top of that 100 songs that was playing on the day that you met your wife or your
husband, or maybe when you started a friendship or started a new job,
and you can send them this playlist as your gift to jog their memories and
remind them of that day in the past.
So are you ready to build the time machine?
If you are, head over to the next lesson while you will find step by step
instructions and a lot of challenges
that's going to get you to use all the skills you learned about how do you use
Beautiful Soup
as well as the Spotify API in order to complete this project.
So head over there now.