#๐Ÿ”’ Front End Page Reloads Right After It Fetches Data From Flask Api

4 messages ยท Page 1 of 1 (latest)

small tundra
#

I am building a Flask + JavaScript web app that works like a lightweight music player

Backend (Flask):

  • Uses yt-dlp to extract audio stream URLs from YouTube.

  • Uses an api for searching the song info like video id and all

  • Has endpoints:

    • /search?q= โ†’ returns songs & videos with title, artist, thumbnail, videoId.
    • /stream/<video_id> โ†’ returns playable url
    • /related/<video_id> โ†’ returns related tracks.
  • Currently deployed on Vercel.

  • Frontend (JS):

    • Calls Flask API endpoints with fetch().
    • Plays the audio stream in the browser.
    • Also fetches lyrics from https://lrclib.net/api/get using title + artist.
  • Problem:

    • On front end after fetching the data from /stream endpoint i get the data and the js code shows it on the console (have used console log for that) and right after showing that info the page reloads automatically
  • What Iโ€™ve Tried:

    • when i remove the cookiefile option in the yt-dlp options then the front end doesnt reload but for the yt-dlp authentication i need to pass the cookiefile

i want to solve the page reload issue and that the only prob

olive cradleBOT
#

@small tundra

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

olive cradleBOT
#

@small tundra

Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.