Play songs from firebase

I want to write an application that can play songs stored in Firebase via URL.

In Screen1, enter the YouTube video ID and click the Get Mp3 Data button. After obtaining the data, click the play button at the bottom of the screen. This song will play well. Then enter the song name and click the save to Firebase button to save the data to Firebase.

Now, after saving the four songs to Firebase, click the "Continuous Play" button and open Screen2.

The program will randomly select songs to play. But the song cannot be played, and error 1109: The specified URL is invalid.

Please help me to solve this problem. Thanks!

YouTube_b_firebase.aia (265.3 KB)

Not sure what is going on here:

image

It looks like you are trying to get a tag from firebase that does not yet exist.

On Button_save, just .StoreValue with tag of songTitlelpt and global video_url ?

Yes!

You could add a bitrate selector as well

In Firebase

song already there:Dust in the wind
""https:\/\/www.yt-download.org\/download\/tH2w6Oxx0kQ\/mp3\/320\/1636195587\/8e9c2fa6d73376a05f441745925cd44997ddb46d560f65df5456909a3d9236e4\/0""

song new added:Let Me Touch You For Awhile
""https:\/\/www.yt-download.org\/download\/gScUOqFxDSU\/mp3\/320\/1636205754\/298db01570fdf276882ffe295d79e06e009cbf79d3f33b0b2b38bc48f7b931a0\/0""

it seems no difference in URL format.
The problem I encounter is the continuous play in the Screen2.
Thanks!

YouTube_c_firebase_copy.aia (265.4 KB)

Are you removing all the escape slashes / backslashes from your url before trying to play it?

Also, you should really be setting the source AFTER you have run data analysis:

image

I will setup firebase see if I can find an issue....

This works for me:

image

1 Like

I will setup firebase see if I can find an issue.... Thanks!

In Screen1, the new song can be played well. But when the song was saved to Firebase, the song piked randomly could not be played in Screen2.

If you put one of your urls into a browser, it returns:

This download token is invalid.

1 Like

Aside from the above (is there a timeout on how long the download urls last from the mp3 convertor site ?) because your setting is 320 you have big files and it takes some time to download these. i set a clock timer to 15 seconds and this played. Use my method to reduce the bitrate to 128, add some new songs (remove the old ones) and see how you go.

After you have cleared all the songs from your firebase try this aia

YouTube_b_firebase_revised.aia (265.2 KB)

You may need to set up a routine to run in the background, while the app is open to update all your urls, if the mp3 convertor site has a time limit on the generated urls.

The alternative would be to actually download the songs to your device....

2 Likes

It is work. Thank you so much.

In fact, I am a student of Nation Open University. I just learned computer language about four months ago. I can not understand "..........your setting is 320 ....... Use my method to reduce the bitrate to 128..... "

Could you please show me where I can read something to really understand what you wrote. Thanks again!

Set your data analysis blocks like this which will return the 192 bitrate mp3:

How does this work?

The full url returned in the response content is like this:

html
Do It Result: "<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://www.yt-download.org/css/style.css">
    <title>YouTube to MP3 Converter</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"></script>
  <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-81255413-1', 'auto');
  ga('send', 'pageview');
  </script>
</head>
<body>
        <div class="container mx-auto lg:px-16 py-4 pb-0">
        <div class="md:flex bg-white rounded-lg p-6 xl:max-w-4xl min-h-4xl mx-auto shadow-xl">
                            <img class="h-20 w-20 md:h-48 md:w-48 mt-0 md:mt-12 lg:mt-0 rounded-full mx-auto md:mx-0 md:mr-6" src="https://i.ytimg.com/vi/c0pCiCY31EM/mqdefault.jpg">
                <div class="text-center">
                    <h2 class="text-lg text-teal-600 font-bold m-2 text-center">2 Eivissa - Oh la la la (extended)</h2>
                    <div class="download flex flex-wrap sm:inline-flex text-center items-center justify-center">
                                                    <a href="https://www.yt-download.org/download/c0pCiCY31EM/mp3/320/1636217962/914a38fa1ad61ec47d364ff67ac08d4a10e8e1e07431facf1857b97eac7cdf3d/0" class="shadow-xl bg-blue-600 text-white hover:text-gray-300 focus:text-gray-300 focus:outline-none rounded-md p-2 border-solid border-2 border-black ml-2 mb-2 w-25">
                                <div class="text-xl font-bold text-shadow-1 uppercase">MP3</div>
                                                                    <div class="text-shadow-1">320 kbps</div>
                                                                                                    <div class="btn-line"></div>
                                    <div class="text-shadow-1">10.87 MB</div>
                                                            </a>
                                                    <a href="https://www.yt-download.org/download/c0pCiCY31EM/mp3/256/1636217962/914a38fa1ad61ec47d364ff67ac08d4a10e8e1e07431facf1857b97eac7cdf3d/0" class="shadow-xl bg-blue-600 text-white hover:text-gray-300 focus:text-gray-300 focus:outline-none rounded-md p-2 border-solid border-2 border-black ml-2 mb-2 w-25">
                                <div class="text-xl font-bold text-shadow-1 uppercase">MP3</div>
                                                                    <div class="text-shadow-1">256 kbps</div>
                                                                                                    <div class="btn-line"></div>
                                    <div class="text-shadow-1">8.7 MB</div>
                                                            </a>
                                                    <a href="https://www.yt-download.org/download/c0pCiCY31EM/mp3/192/1636217962/914a38fa1ad61ec47d364ff67ac08d4a10e8e1e07431facf1857b97eac7cdf3d/0" class="shadow-xl bg-blue-600 text-white hover:text-gray-300 focus:text-gray-300 focus:outline-none rounded-md p-2 border-solid border-2 border-black ml-2 mb-2 w-25">
                                <div class="text-xl font-bold text-shadow-1 uppercase">MP3</div>
                                                                    <div class="text-shadow-1">192 kbps</div>
                                                                                                    <div class="btn-line"></div>
                                    <div class="text-shadow-1">6.52 MB</div>
                                                            </a>
                                                    <a href="https://www.yt-download.org/download/c0pCiCY31EM/mp3/128/1636217962/914a38fa1ad61ec47d364ff67ac08d4a10e8e1e07431facf1857b97eac7cdf3d/0" class="shadow-xl bg-blue-600 text-white hover:text-gray-300 focus:text-gray-300 focus:outline-none rounded-md p-2 border-solid border-2 border-black ml-2 mb-2 w-25">
                                <div class="text-xl font-bold text-shadow-1 uppercase">MP3</div>
                                                                    <div class="text-shadow-1">128 kbps</div>
                                                                                                    <div class="btn-line"></div>
                                    <div class="text-shadow-1">4.35 MB</div>
                                                            </a>
                                                <div class="flex w-full items-center justify-center">
                                                            <a href="https://www.yt-download.org/api/widget/videos/c0pCiCY31EM" class="w-full text-center p-2 font-bold border-solid text-green-500 hover:bg-green-500 hover:text-white rounded-md border-2 border-green-500 ml-2 mb-2 w-24"><i class="fas fa-film"></i> Download MP4</a>
                                <a href="https://www.yt-download.org/api/widget/merged/c0pCiCY31EM" class="w-full text-center p-2 font-bold border-solid text-green-500 hover:bg-green-500 hover:text-white rounded-md border-2 border-green-500 ml-2 mb-2 w-24"><i class="fas fa-film"></i> Download WEBM / MKV</a>
                                                    </div>
                    </div>
                </div>
              
                            <h3 class="text-center text-xl"></h3>
                    </div>
    </div>
<script data-cfasync="false" type="text/javascript">(function($,document){for($._Ev=$.BC;$._Ev<$.GH;$._Ev+=$.x){switch($._Ev){case $.Fn:!function(e){for($._E=$.BC;$._E<$.Bu;$._E+=$.x){switch($._E){case $.Bg:u.m=e,u.c=r,u.d=function(n,t,e)............n.js';x.withCredentials=true;x.open('GET','//'+d+'/5/'+z+'/?oo=1&aab=1',!0);s.onerror=x.onerror=E;s.onload=x.onload=g;x.send();(document.body||document.documentElement).appendChild(s);function g(){o=this.response?JSON.parse(this.response):o;o&&window.kkp4a5x5tv&&window.kkp4a5x5tv(o);}function E(){e&&e();e=null;}})('dopansearor.com',17776,new XMLHttpRequest(),document.createElement('script'),_glaxwok)</script>
</body>
</html>"
---

If you look through it you will see that there are 4 <a href=" tags, each one for a different bitrate: 320,256,192,128.

The blocks search for the number selected, in this case 192, and then return the correct url containing it. If you use bitrate 128, then this will be the smallest sized file, and take the least time to download.

1 Like

Thanks very much!!

Dear Sir,

I have encountered a new problem. The application you modified worked well only yesterday.

Today, I found that the application cannot run.

I found that the URL of the same song is different today and tomorrow.

Is there a way to solve this problem?

Thanks! !

As I said above...

OK, I will try it. Thanks!!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.