Tools Fansly - Capturing livestreams (Bash script)

Marcus

ʕ•ᴥ•ʔ
Mar 11, 2022
257
23,517
1,568
0fya082315al84db03fa9bf467e3.png
For anyone else that it's interested in capturing Fansly livestreams, I've written a Bash script that automates the process. I simply run this script as a cronjob (scheduled task) for the creators I want to capture.

Note that the script has only been run & tested on Linux (Debian/Ubuntu). It might work using Git Bash (or similar) on Windows, but I honestly don't know as I don't rely on Windows for these things.
It should work fine using Windows Subsystem for Linux (WSL) though, as that's practically a Linux virtual machine.

Mac? No idea. If you can somehow install the software listed in the software requirements, I don't see why not.

Script itself can be found on GitHub:
Please, Log in or Register to see links and images


Here's also a copy of the script as of August 30th, 2023:

Please, Log in or Register to view spoilers

The GitHub link is your best bet for the most up-to-date script though, as I might forget to update this post with any changes.

Software requirements​

What you need to have installed where you run the script:
  • curl - Used for requesting info from Fansly's API
  • ffmpeg - Used for the actual video capture
  • jq - Used for parsing the info from Fansly's API
On Debian / Ubuntu based systems, you can install all the software via apt: apt install curl ffmpeg jq

Getting your Fansly token & user agent​

You need to have a Fansly account for this. Depending on the Fansly creator you're capturing, you may also need to be following and subscribed to them. Most of the ones I've seen simply need you to follow them though, which is free.

For your user agent and Fansly token, you can do the following:
  1. Open Fansly.com in your browser, make sure you're logged in.
  2. Open the browser console in developer tools (F12 / CTRL+Shift+I)
  3. Paste the following into the browser console input, it will copy your Fansly tokento the clipboard
    1. copy(JSON.parse(localStorage.session_active_session).token);
  4. Open the fansly-stream-capture.sh file in your favorite text editor.
  5. Set the FANSLY_TOKEN value in the beginning of the script, or as an environment variable. If setting it in the script, it is on line 14, at the time of writing this post.
    1. If you paste it into the script, make sure to remove the hash symbol (#) at the beginning of the line.
    2. Wrong: # FANSLY_TOKEN="your-token-here"
    3. Correct: FANSLY_TOKEN="your-token-here"
  6. For the user agent, paste the following into your browser console input and it will also be copied into the clipboard
    1. copy(navigator.userAgent);
  7. Set the USER_AGENT value in the beginning of the script, or as an environment variable. If setting it in the script, it is on line 17, at the time of writing this post.
    1. If you paste it into the script, make sure to remove the hash symbol (#) at the beginning of the line.
    2. Wrong: # USER_AGENT="your-user-agent-here"
    3. Correct: USER_AGENT="your-user-agent-here"

[Optional] Setting the base path​

Setting the base path will allow you to save all the streams in one main directory.
If the base path is not set, it will default to the current working directory where you are running the script.

All livestreams will be saved in a similar format of ${BASE_PATH}/${FANSLY_USERNAME}/${YYYY-MM-DD}_${FANSLY_NUMERIC_CREATOR_ID]_${STREAM_ID}_${EPOCH_TIMESTAMP}.ts

For example if BASE_PATH=/home/marcus/livestreams, any livestreams I capture of Kati3kat would be saved under /home/marcus/livestreams/Kati3kat/2023-08-04_123456789_696969420_1691183787.ts

If you're planning on running the script as a cronjob, I recommend setting the base path. Either in the file or as an environment variable.

Using the script​

Once you've set your values correctly, you can test it by finding someone that's live on Fansly (or waiting for someone to go live).
Open your terminal, and run the script while passing the username as a parameter: bash fansly-stream-capture.sh FanslyUsername
 
Last edited:

Marcus

ʕ•ᴥ•ʔ
Mar 11, 2022
257
23,517
1,568
0fya082315al84db03fa9bf467e3.png
Reserving this post in the thread in case I need it in the future.
 

yticpmis234

Bathwater Drinker
Jun 3, 2023
283
11,209
1,282
0fya082315al84db03fa9bf467e3.png
Now this is a quality post !!! :peepoClap:

BTW people check out some of their other scripts
Please, Log in or Register to see links and images
!!!!!!

Thank you for anonfiles-upload.sh !!!
 
  • PeepoBlanket
Reactions: Marcus