<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jeffrey</title>
    <description>The latest articles on Forem by Jeffrey (@jeffreyca).</description>
    <link>https://forem.com/jeffreyca</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F459785%2F100384f1-400d-46d3-99fc-adeedba8c801.png</url>
      <title>Forem: Jeffrey</title>
      <link>https://forem.com/jeffreyca</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jeffreyca"/>
    <language>en</language>
    <item>
      <title>Display your recent Last.fm and Spotify listening activity on your GitHub profile README</title>
      <dc:creator>Jeffrey</dc:creator>
      <pubDate>Mon, 07 Sep 2020 17:51:43 +0000</pubDate>
      <link>https://forem.com/jeffreyca/display-your-recent-last-fm-and-spotify-listening-activity-on-your-github-profile-readme-8jo</link>
      <guid>https://forem.com/jeffreyca/display-your-recent-last-fm-and-spotify-listening-activity-on-your-github-profile-readme-8jo</guid>
      <description>&lt;p&gt;GitHub recently introduced profile READMEs as a way to enhance your personal GitHub profile with Markdown and HTML.&lt;/p&gt;

&lt;p&gt;I was inspired by the creativity of the open-source community - through various widgets like &lt;a href="https://github.com/anuraghazra/github-readme-stats" rel="noopener noreferrer"&gt;github-readme-stats&lt;/a&gt; and &lt;a href="https://github.com/kittinan/spotify-github-profile" rel="noopener noreferrer"&gt;spotify-github-profile&lt;/a&gt; - to create something for all the music lovers out there.&lt;/p&gt;

&lt;p&gt;I created two tools (hosted on &lt;a href="https://vercel.com" rel="noopener noreferrer"&gt;Vercel&lt;/a&gt;) that lets you display your recent Last.fm and Spotify listening activity as a card so they can be embedded into your profile README.&lt;/p&gt;

&lt;h3&gt;
  
  
  Last.fm Recently Played README
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flastfm-recently-played.vercel.app%2Fapi%3Fuser%3DJeffreyCA01" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flastfm-recently-played.vercel.app%2Fapi%3Fuser%3DJeffreyCA01" alt="My scrobbles"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get started, just add the following to your README and set the &lt;code&gt;user&lt;/code&gt; query parameter to your Last.fm username.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;![&lt;/span&gt;&lt;span class="nv"&gt;My scrobbles&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://lastfm-recently-played.vercel.app/api?user=JeffreyCA01&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more configuration options, see the &lt;a href="https://github.com/JeffreyCA/lastfm-recently-played-readme#link-to-lastfm-profile" rel="noopener noreferrer"&gt;GitHub repo README&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Vercel app uses the Last.fm API (unauthenticated) to get your recent scrobbles, since it's all public information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spotify Recently Played README
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fspotify-recently-played-readme.vercel.app%2Fapi%3Fuser%3Djeffreyca16" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fspotify-recently-played-readme.vercel.app%2Fapi%3Fuser%3Djeffreyca16" alt="Spotify recently played"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, you'll need to connect your Spotify account with the tool by clicking the button below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://spotify-recently-played-readme.vercel.app/" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FJeffreyCA%2Fspotify-recently-played-readme%2Fraw%2Fmaster%2Fassets%2Fauth.png" alt="Authorize app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Why is this needed?
&lt;/h4&gt;

&lt;p&gt;Since your Spotify recent listening activity is not public, the Spotify API requires you (the account owner) to authorize the app to be able to access that information.&lt;/p&gt;

&lt;p&gt;Your Spotify username, access token, and refresh token will then be stored on a secure Firebase database, so that access tokens can be automatically refreshed in the background after they expire (in 1 hour).&lt;/p&gt;

&lt;h4&gt;
  
  
  Continuing on
&lt;/h4&gt;

&lt;p&gt;After granting permission, just add the following to your README and set the &lt;code&gt;user&lt;/code&gt; query parameter to your Spotify username.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="p"&gt;![&lt;/span&gt;&lt;span class="nv"&gt;Spotify recently played&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;https://spotify-recently-played-readme.vercel.app/api?user=jeffreyca16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more configuration options, see the &lt;a href="https://github.com/JeffreyCA/spotify-recently-played-readme/blob/master/README.md#link-to-spotify-profile" rel="noopener noreferrer"&gt;GitHub repo README&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final thoughts
&lt;/h3&gt;

&lt;p&gt;This was a fun little project I developed using TypeScript, Next.js/Vercel, and React. I also learned a lot about OAuth 2 authorization while working with the Spotify Web API.&lt;/p&gt;

&lt;p&gt;Everything is open-source, you can check it out on GitHub:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/JeffreyCA/lastfm-recently-played-readme" rel="noopener noreferrer"&gt;https://github.com/JeffreyCA/lastfm-recently-played-readme&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/JeffreyCA/spotify-recently-played-readme" rel="noopener noreferrer"&gt;https://github.com/JeffreyCA/spotify-recently-played-readme&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bug reports, feature requests, and code contributions are welcome!&lt;/p&gt;

</description>
      <category>github</category>
      <category>showdev</category>
      <category>spotify</category>
      <category>lastfm</category>
    </item>
  </channel>
</rss>
