chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 582 forks source link

[Plugin request] Myfreecams #561

Open TL447 opened 9 years ago

TL447 commented 9 years ago

On their mobile site http://m.myfreecams.com/ some of the shows have mobile feeds, IIRC they are HLS. I've been able to get the RTMP URL by pressing the live feed button and inspecting the player area but now it says my browser doesn't support video playback.

VackerSimon commented 9 years ago

When you visit a room on the mobile site m.myfreecams.com it loads a URL that looks like this http://video462.myfreecams.com:1935/NxServer/mfc_107253378.f4v_aac/playlist.m3u8?nc=1423603882490 which can be played in livestreamer with hlsvariant:// infront. It will play fine without the nc parameter so that can be skipped.

The information you need to fill out the URL can also be found on the desktop site. In the object with id "fvideo" there are a few , the one with name="flashvars" has all the info you need. server=video463 and roomID=107253378 which you just put in http://$server.myfreecams.com:1935/NxServer/mfc_$roomID.f4v_aac/playlist.m3u8

I don't know how to make a plugin but the information above might help someone make one, I'm not sure how you go directly to a room tho.

Sembiance commented 9 years ago

I figured out how to do this with code.

Here is a node.js script that will take a myfreecams URL or model name, and output the correct livestreamer hlsvariant url: https://gist.github.com/Sembiance/df151de0006a0bf8ae54 Note: You need to run npm install websocket before running the node.js script.

Essentially the steps are:

  1. Connect to the myfreecams websocket chat server (with appropriate origin and cookie)
  2. Send appropriate hello and guest login message
  3. Wait for message type '005369' which contains a URL encoded 'fileno' field
  4. Fetch a javascript file from web: "http://www.myfreecams.com/mfc2/php/mobj.php?f=" + fileno + "&s=xchat20"
  5. Parse part of the JS file as JSON and then find the matching username (nm field) in the list of users and get the users 'uid' and 'camserv'
  6. Format the url as: hlsvariant://http://video" + (modelData.u.camserv-500) + ".myfreecams.com:1935/NxServer/mfc_" + (100000000+modelData.uid) + ".f4v_aac/playlist.m3u8?nc=1423603882490"

Now you can execute livestreamer with the outputed hlsvariant URL and it will work.

Should be fairly straightforward for someone to convert my nodejs script into a python plugin.

dardo82 commented 9 years ago

I have done that, related to MyFreeCams, if it can help: http://gist.github.com/dardo82/f037908b4fb6b501bdfd It is a simple script in bash to watch it on AppleTV... 8-)

#!/bin/sh

ROOMID="$(curl -s $(echo "$1" | awk '{sub(/www/,"profiles"); sub(/#/,""); print $0}') | awk -F/ '/\/[0-9]{7,8}\//{print $6; exit}')"
if [ ${#ROOMID} -eq 7 ]; then
        PREFIX="10"; else
        PREFIX="1"
fi

MFCURL="http://video4  .myfreecams.com:1935/NxServer/mfc_$PREFIX$ROOMID.f4v_aac/playlist.m3u8"
for n in $(seq 38 92); do
        STREAM=${MFCURL/  /$n}
        if [ $(curl -s -Y1024 -y1 $STREAM | grep CODECS) ]; then
                break
        fi
done

echo $STREAM
ENCURL=$(curl -s -G -w %{url_effective} --data-urlencode $STREAM "" | awk '{print substr($0,3)}')
open "airflick://"; sleep 10; open "airflick://play-media?MediaLocation=$ENCURL"
Alexo88 commented 6 years ago

i need this but im new.

dardo82 commented 6 years ago

i need this

Then use it.

Alexo88 commented 6 years ago

i need this

Then use it.

looks like rrly complex for me. it fis working?

dardo82 commented 6 years ago

i need this

Then use it.

looks like rrly complex for me. it fis working?

Your English isn’t working, fix it first.

Alexo88 commented 6 years ago

i need this

Then use it.

looks like rrly complex for me. it fis working?

Your English isn’t working, fix it first.

sorry. looks like rrly complex for me. it is working?

dardo82 commented 6 years ago

i need this

Then use it.

looks like rrly complex for me. it fis working?

Your English isn’t working, fix it first.

sorry. looks like rrly complex for me. it is working?

...