orel56000 Posted May 31, 2018 Share Posted May 31, 2018 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
itHyperoX Posted May 31, 2018 Share Posted May 31, 2018 I think you can use this https://wiki.multitheftauto.com/wiki/GetSoundMetaTags Link to comment
orel56000 Posted May 31, 2018 Author Share Posted May 31, 2018 (edited) 9 minutes ago, TheMOG said: I think you can use this https://wiki.multitheftauto.com/wiki/GetSoundMetaTags Ill try that out, thanks. but there still a option to do that with fetchRemote? I wanna learn how to use this function Edited May 31, 2018 by orel56000 Link to comment
Addlibs Posted May 31, 2018 Share Posted May 31, 2018 (edited) 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). Edited May 31, 2018 by MrTasty 1 Link to comment
Z4Zy Posted May 31, 2018 Share Posted May 31, 2018 (edited) What about this ? any problem ?? radio Works fine Client Side :- function turnRadio () playSound("http://listen.181fm.com/181-power_128k.mp3?listenerid=4721ecee868b8ca5206a2a09d59329fe&esPlayer&cb=924945.mp3") end addCommandHandler("radio",turnRadio) Edited May 31, 2018 by DeadthStrock Link to comment
orel56000 Posted May 31, 2018 Author Share Posted May 31, 2018 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 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
Addlibs Posted June 1, 2018 Share Posted June 1, 2018 (edited) 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) (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 June 1, 2018 by MrTasty 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now