agnosto / fansly-recorder

Record fansly streams live and upload to remote using rclone
https://fansly.com/live/your-fav-egirl
10 stars 2 forks source link

Windows installation and run problems #1

Closed redcomando1 closed 1 year ago

redcomando1 commented 1 year ago

On Windows 10, looking for complete guide for installation and running.

needed programs -python -github [https://github.com/agnosto/fansly-recorder] [https://github.com/mutschler/mt#installation-from-source] -Rclone -Tmux

the step by step guide in place is requiring unfamiliar software that is complicating the install, and is requiring learning this software.

Is there a way to run the bot(s), and have the files be locally downloaded and if possible run with .exe or guide for windows setup.

agnosto commented 1 year ago

This script was designed mostly for unix like systems to be used on servers to auto-download the streams even if you're not at your pc or it's off, which is why it also uses webhooks to notify when a model is live. All the software would be highly recommended to learn as well as being usable on windows.

However; to use on windows in a similar fashion(minus if the pc is off) would require a bit of editing of the script or use WSL which is honestly probably what i would recommend, but the first might be better suited. You would still need to edit some stuff if you just want it all to be local.

You'll need the following regardless of which you choose to do:

Non-wsl local use: Since I'm not currently on windows to confirm i'm just gonna give the lines that i'm pretty sure you would need to get rid of to have this work completely locally: (look at the script on github to be sure of the lines while getting rid of them)

ln 14-20, ln 137-180, (this will get rid of the making of a thumbnail sheet of the live and the uploading of it) ln 191 (gets rid of the call to the upload function )

and if you don't want webhooks to be notified: ln 12, ln 122-133, ln 201-219, ln 239 (and get rid of the # on ln 240)

that should be everything you need to change to get it working locally, you just need to open a terminal in the same folder as the script and run pip install -r requirements.txt then python3 fansly-recorder.py {username} and it should work completely locally.

I will also be working on it to add config options to make it more modular and allow for base use locally or more robust automated use

redcomando1 commented 1 year ago

Thank you for replying and posting a guide for WSL, I've got python, and ffmpeg setup through the guide.

got a warning on the pip install -r requirements.txt [warning below]

WARNING: The script tqdm is installed in '/home/bluestone/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The scripts futurize and pasteurize are installed in '/home/bluestone/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script normalizer is installed in '/home/bluestone/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. WARNING: The script discord_webhook is installed in '/home/bluestone/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Don't know if this is normal.. also getting zero exit status 127 when starting recording for a user which didn't need to be followed, etc didn't edit the python file yet but will, and will try to see what i need to do to get this to work. [error below]

bluestone@zserve1:/mnt/c/users/redco/desktop/testting$ python3 fansly-recorder.py xkonekoneko [info] Starting online check for xKonekoNeko Webhook status code 404: {"message": "Unknown Webhook", "code": 10015} [warning] Failed to send webhook notification: 404 Not Found [ffmpeg] Saving livestream to xKonekoNeko_20230722_161259_v413838500446609409.ts /bin/sh: 1: ffmpeg: not found Traceback (most recent call last): File "/mnt/c/users/redco/desktop/testting/fansly-recorder.py", line 194, in asyncio.run(Start()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/mnt/c/users/redco/desktop/testting/fansly-recorder.py", line 189, in Start await startRecording(user_Data, data) File "/mnt/c/users/redco/desktop/testting/fansly-recorder.py", line 136, in startRecording await ffmpegSync(filename, data) File "/mnt/c/users/redco/desktop/testting/fansly-recorder.py", line 96, in ffmpegSync subprocess.run(command, shell=True, check=True) File "/usr/lib/python3.10/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command 'ffmpeg -i https://8e69c661e048.us-east-1.playback.live-video.net/api/video/v1/us-east-1.862541535858.channel.6AuOBVBgAmys.m3u8?token=eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJhd3M6Y2hhbm5lbC1hcm4iOiJhcm46YXdzOml2czp1cy1lYXN0LTE6ODYyNTQxNTM1ODU4OmNoYW5uZWwvNkF1T0JWQmdBbXlzIiwiZXhwIjoxNjkwMDcwOTEyLCJpYXQiOjE2OTAwNzA5MDJ9.O042aySCGrpfW6SYGjfx_xX9goBZ-wUF-GVVXGO7xYtKQkcCXaaK84j44Z5pwP83QNtu2lJXw2IY3tmXsgNmkZhry18MRq8WITeu4cCYSqYC5Yuw0mIVdqT_yjslKFk1 -c copy -movflags use_metadata_tags -map_metadata 0 -timeout 300 -reconnect 300 -reconnect_at_eof 300 -reconnect_streamed 300 -reconnect_delay_max 300 -rtmp_live live xKonekoNeko_20230722_161259_v413838500446609409.ts' returned non-zero exit status 127.

redcomando1 commented 1 year ago

ffmpeg seemed to not be in the wsl so I installed in it the wsl and now im getting [error]

bluestone@zserve1:/mnt/c/users/redco/desktop/testting$ python3 fansly-recorder.py succupuplily Traceback (most recent call last): File "/mnt/c/users/redco/desktop/testting/fansly-recorder.py", line 194, in asyncio.run(Start()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/mnt/c/users/redco/desktop/testting/fansly-recorder.py", line 177, in Start user_Data = await getAccountData(account_url) File "/mnt/c/users/redco/desktop/testting/fansly-recorder.py", line 23, in getAccountData async with aiohttp.ClientSession(connector=connector, headers=headers) as session: File "/home/bluestone/.local/lib/python3.10/site-packages/aiohttp/client.py", line 299, in init real_headers: CIMultiDict[str] = CIMultiDict(headers) TypeError: CIMultiDict takes either dict or list of (key, value) pairs Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f4892132f20>

agnosto commented 1 year ago

I'm not entirely sure but I have a guess, which I did make note of in the dev branch (that i'll be merging soon that makes some changes) with a work around:

One thing to try doing, is changing both instances of this:

async with aiohttp.ClientSession(connector=connector, headers=config.headers) as session:

to this (getting rid of connector=connector):

async with aiohttp.ClientSession(headers=config.headers) as session:

Regarding the issue with PATH, the following may resolve that:

  1. type nano ~/.bashrc in wsl
  2. go to the bottom and add the following:
    if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
    fi
  3. Hit ctrl + x then y then enter
  4. type source ~/.bashrc

From there ensuring the requirements are gotten again:

pip3 install -r requirements.txt

As well as ensuring ffmpeg is setup to be used

ffmpeg -version

and just incase anyone else comes across this, you can run the following to install python and ffmpeg on wsl as such:

sudo apt install python3 ffmpeg -y

Other than that, the newer version of the script should be coming within a couple days that will allow you to disable certain things instead of having to get rid of things but the core of it is mostly the same so you could just stick with what you have now if it starts working. It will use more header inputs and account token to get streams that require following/sub tho

Also wsl isn't needed as python scripts will run on windows as well, but the way installing apps on there works is easier than editing system variables to use anywhere (at least for me).

redcomando1 commented 1 year ago

thank you again for replying, I completed the fixes you had posted, currently testting it to see if it will work.

to add my cookies to the header while using WSL, do I use the one from my firefox on windows or do I have to set some thing else up.

on a side note I see something for account_id

agnosto commented 1 year ago

yea the ones from your browser, you can replace the

headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
    }

in the script with the following:

headers = {
        'authority': 'apiv3.fansly.com',
        'accept': 'application/json, text/plain, */*',
        'accept-language': 'en;q=0.8,en-US;q=0.7',
        'authorization': 'your_auth_token_here',  # Replace with your actual auth token
        'origin': 'https://fansly.com',
        'referer': 'https://fansly.com/',
        'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"Windows"',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-site',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
}

and this is a short guide i write for getting the token.

And instances of account_id are the models account id, used to get the link to record the live.

redcomando1 commented 1 year ago

Need to test more however, is working so far, will close

Thank you so much for your help was able to run it in wsl on tmux and is running fine.