ゆめのHey!'s profile picture

Published by

published
updated

Privacy: Link-only
Category: Web, HTML, Tech

[BETA] Last.fm embed with music player style!!!!

[UPDATE 2.0!]

NONE of this is needed anymore. I will leave it public if anyone wants to know how I did it. You find the easier and updated version HERE.

This version will be kept link-only.



This project was literally a Frankenstein's monster bc I used snippets of code of like... 3 projects. AAAAnyways bc I don't gatekeep (but I don't think you should try it. the code is MESSY) this is the link of my repo:

https://github.com/yumenism/lastfm-now-playing

(I will eventually release a better version)

You can read what actually good coders actually did in:


so... how does it work?
because this code was made only for me, the experience will be a little... confusing.
If you just want to embed a simple now playing, you can just follow the 3rd link (if you want to style it, read the 1st link).

Now time to explain (you'll need a github account, sorry for that)
  1. Fork my repo:

    (click the "fork" button, I can't fork it because it's my own repo)
  2. You will need to edit 2 files so you can fetch your data:
      The main.js file (on public folder)
      now-playing.js file (on api folder)
  3. To edit those, you will need to find them (open api/public folders and click the files) and you'll be able to see the code:(click the "pencil" button, then change yumenism to your username (remember to keep the quotation marks). then click "commit changes", the green button on the top right of the code editor. it'll open a little window. just click "commit changes" again. do the same for the other file.)
  4. Now your repo is done! Now you'll need to deploy it with vercel.
      Login with your github account
  5. You should be able to see this:


  6. (click the "import" button. it should redirect you to the next page)
    (click the "import" button again on the repository you just made. It will redirect you to other window, but we're not going to change any settings, so just click on "deploy".)
    After that, it will show you this:
    Which means we're FREE!!!!! Click on the image (you will be redirected to a page with 404 not found. DO NOT WORRY, you won't use this page anyway), copy the URL and just close both windows and pray to never need to see any of them again.
  7. After that, go to where you want to embed your music player.
  8. Paste
    <a href="https://www.last.fm/user/YOURUSERNAME" target="_blank">
    <div style=" border-radius: 8px; width: 305px;   height: 50px;   background-image: url('https://external-media.spacehey.net/media/sEpY56IKUlhCSqiV8BzxTZU1nju6NO14jZKW0WCD9T4I=/https://file.garden/ZRYtsnIP2EXOR4Kw/Site%20Files/musicplayer.png');   background-size: cover;   position: relative; ">
    <img src="YOURLINK/api/now-playing" alt="Now Playing"/>
    </div>
    </a> where you want it to be.
  9. Remember to change "YOURUSERNAME" to your last.fm username (you can just link it to another site completely if you want to). and in YOUR LINK, paste the link you copied from that vercel page and add /api/now-playing in the end (ex: the URL i copied was https://lastfm-now-playing-d7dm.vercel.app/, so i add https://lastfm-now-playing-d7dm.vercel.app/api/now-playing. in the img source.)
  10. ITS READY!!!! I hope.
Please tell me if something goes wrong. I will definitely make it a lot easier in the future, because it was just a personal project. If you guys wanna a easier experience you can comment and I'll code a version without all these complicated things


Comments

Displaying 2 of 2 comments ( View all | Add Comment )

ゆめのHey!

ゆめのHey!'s profile picture
Pinned

For all coders :D
I made this between classes and ended up with a semi-usable version at 2am bc I just couldn't sleep before knowing it was going to work. Which means the code is VERY flawed and probably VERY bad. That being said, please be kind with your feedback, and you are 100% incentivized to correct me, I really had fun with this project even if I slept only 3hrs in total, so I want to keep working on it.


Report Comment

putupaula

putupaula's profile picture

will try it out


Report Comment



Hi! sorry for bothering you, but I updated the blog with the newer version. Now this setup is practically useless since the new project changes users dynamically. Thank you for commenting tho, it gave me the motivation needed to make it simpler!

by ゆめのHey!; ; Report

HUGE, glad i inspired you :D

by putupaula; ; Report