Jump to content

fetchRemote


Recommended Posts

Hi, I'm having problems with understanding about fetchRemote and I can't find anything about what I want in the internet.

I'm trying to get the song that playing in a online radio website: http://www.181.fm/player/?station=181-power

I have tried to check if i can get a song with this command and its not working (the song was Alone (Clean)) and its not working, please help?

fetchRemote("http://player.181fm.com/?station=181-power", 2, 5000, function(responseData, errno)
			if errno == 0 then
				local sfind, efind = string.find(responseData, "Alone (Clean)")
			--	outputChatBox(string.sub(responseData, sfind-100, sfind+100))
				if sfind ~= nil then outputChatBox("YES") else outputChatBox("no") end
			end
			outputChatBox(errno..", "..string.len(responseData))
		end, "", true)

Thanks for helpers!!

Link to comment
3 hours ago, MrTasty said:

After inspecting the website, you wouldn't find the name of the song on it since it is loaded from a different page via javascript, more specifically, loaded from http://player.181fm.com/streamdata.php?h=listen.181fm.com&p=7080&i=181-power_128k.mp3. So you should try to fetchRemote that and (if necessary, decode JSON).

Thank you, how did you got this link?

2 hours ago, DeadthStrock said:

What about this ?  any problem ?? radio Works fine :lol:  :lol:  :lol:  :lol:

Client Side :-


function turnRadio () 
    playSound("http://listen.181fm.com/181-power_128k.mp3?listenerid=4721ecee868b8ca5206a2a09d59329fe&esPlayer&cb=924945.mp3")
end
addCommandHandler("radio",turnRadio)

 

the problem was to find the name of the song via fetchRemote.. not to hear the music, and not to find the name via a command, I just wanted to learn how to use fetchRemote cause I found almost nothing on google

Link to comment
13 hours ago, orel56000 said:
16 hours ago, MrTasty said:

After inspecting the website, you wouldn't find the name of the song on it since it is loaded from a different page via javascript, more specifically, loaded from http://player.181fm.com/streamdata.php?h=listen.181fm.com&p=7080&i=181-power_128k.mp3. So you should try to fetchRemote that and (if necessary, decode JSON).

Thank you, how did you got this link?

Internet browser's dev tools (Ctrl+Shift+I) (Network logging, filtered by XHR, and just look through those listed there and check each's response data, one of 'em will have the song name (in this case, it's streamdata.php)

qrHbsm8.png

(How it looks on macOS Safari, most browsers like Chrome should look very similar)

 

Edit: After looking into this a little bit more, you can easily modify the URL I gave to collect the song name of any stream. http://player.181fm.com/streamdata.php?h=<host>&p=<port>&i=<file>

Edited by MrTasty
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...