An OpenSource BOT for Facebook Frame in Order
that runs without 24/7 hosting costs
This section tells how to make it work. In more detailed way.
Note
Grammatical Errors ahead, we're not native english speaker so please bear with us.
Click Here to Show
To set up a Facebook long-lived access token, follow these steps:
- Go to Facebook Developer
- Click
My Apps
- Click
Create App
- Click
Business
andNext
(Business has more perks, than others so pick it) - This is very Self Explanatory, I guess you already know what to do.
- Hover through
tools
and ClickGraph Api Explorer
- Grant Permissions for token, Click
Add a Permission
, Then clickEvents Groups Pages
click all the following
[!NOTE] The scopes should be color
black
as the image shows, If it shows colorgreen
it means it's not yet applied to the token. (Repeat the proccess if the next step doesn't work)
- Click on
User Token
and choose the page you want. - There's gonna popup there, just give the App Permissions and Authorize it.
- Now Click
Generate Access Token
and set theUser Token
to the page you want, then copy the Short-Lived-Token - Go back to
Dashboard
Again. Then hover throughtools
and clickAccess Token Debugger
- Insert the Token you copied earlier and Click
Extend Access Token
- Now Copy it and Save it Somewhere
Click Here to Show
You need to use Windows Powershell to use program called FFMPEG
We need to install Scoop First, before installing FFMPEG
To open Windows Powershell
:
- Click
Windows Button
- And Search for
Windows Powershell
then Right-Click and clickRun as Administrator
After you open it, Run this command:
iwr -useb get.scoop.sh | iex
[!TIP] If theres an error occured, just run the command below and re-run the command above. (Disregard the command below if theres no error appeared)
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
Now Run this command, to install FFMPEG
and GIT
:
scoop install ffmpeg git
After succeeding, Now run these commands:
md "$($env:USERPROFILE)\Desktop\frames"
cd "$($env:USERPROFILE)\Desktop\frames"
This folder will appear on your Desktop, And thats where you will replace your video you want to chop
Now chop the video by running this command:
ffmpeg -i "video.mkv" -r 2 -q:v 3 frame_%00d.jpg
-i "video.mkv"
input file-r 2
is the frames chopped per second (needed inconfig.conf
)-q:v 3
qualityframe_%00d.jpg
output file
Wait until it finished...
[!NOTE] This is getting this info is deprecated, no need for you to gather it.
Then, we're gonna gather the infos of Video and Make sure to Take note all the infos needed.
To get the total frames of the video. (You can see this info too while chopping the frames)
ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 video.mkv
To get the frame rate of the video (If you get fractions "24/1" omit "/1")
ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of default=noprint_wrappers=1:nokey=1 video.mkv
Then now we're gonna upload the frames to GitHub.
Open your Windows Powershell
and Run the Command below:
cd ..
git clone https://github.com/{your_username_here}/{repo_name}
[!IMPORTANT] Make sure that you already created a repository for this template.
{repo_name}
stands for the name of your repo you created for this template
Now, Run this command:
cd {repo_name}
Copy-Item -Path "$($env:USERPROFILE)\Desktop\frames\frame_*.jpg" -Destination frames -Recurse
git init
git add .
git commit -m "frames, update"
Provide your Git Infos, Must be the same as your username and email (it will not display it on public):
git config --global user.name "<your-username>"
git config --global user.email <your-email@gmail.com>
Now get your GitHub token, refer to this tutorial...
- And finally, Push the changes to the repository:
git remote set-url origin https://{your_username}:{your_token_here}@github.com/{your_username}/{repo_name}
git push origin master
Click Here to Show
- Add subtitle file (only supported *.ass/*.ssa, *.srt subtitles)
- Insert all the infos needed in
config.conf
file. https://github.com/fearocanity/ebtrfio-template/blob/039f6e9cf9f89356b7b8bd60b074f36a6ef9d8d4/config.conf#L4-L8
- And push it to master.
We need to setup our repo secret variables too...
-
To setup it, first go to
Settings
on your GitHub Repo. -
Under the
Secrets and Variables
section, ClickActions
-
Then click
New Repository Secret
-
The name must be
TOK_FB
, And Paste your Long-Live Facebook you save earlier, Then clickAdd Secret
.- (Optional) You can add the GIF token too by creating again, and it is named
TOK_GIF
- (Optional) You can add the GIF token too by creating again, and it is named
-
Go to
Settings
again, UnderActions
, clickGeneral
-
Click
Read and Write Permission
andsave
it. -
Then you're good to go for a test now. You're Done!!
Important
All the contents you post will not be shown to public if it not set to Live
Click Here to Show
Click Here to Show
[!CAUTION] We prefer not doing this (The BOT is already running), because it will cause to run the workflow twice when the automatic run was executed. it'll cause duplication. Instead do Manually Disable Workflow. Make sure you know what you're doing. (This is helpful if you want to run the posting after you enable the workflow)
Click Here to Show
- Click on
Actions
- Click on
init banner
, and click the three dots···
. Then finally, click onDisable Workflow
[!TIP] Enabling it pretty much the same procedure, It will appear the enable button at the top.
Click Here to Show
-
And change the cron syntax
0 */2 * * *
, this cron syntax stands forevery 2 hrs
, so you can just change the2
based on your likings. Or you can make your own cron here.
[!CAUTION] Make sure you know what you're doing, This might cause duplications and errors on posting. And before you adjust it, make sure the product of
fph
andmins
mustn't exceed to the number of hours you set on cron. Assume you havefph=50
andmins=5
, so the product of it is:50 * 5 = 250
, then divide it with 60 to know the number of hours:250 / 60 = 4.16 hrs
Tip
- By Default, the bot will automatically run every 2 hrs. (This is our Standard Interval posting)
- We recommend to use
Use this Template
button rather than forking this repository. - We recommend Creating a Pull Request when you're setupping frames for next episode/series to track your changes and guides you on what steps you will take.
- Make sure not to push something in master while the BOT is running. Wait it to be finished first to avoid duplicatiom issues.
- Keep your repository updated with parent repository for fixes and security measure updates.
- When proceeding to a new Episode, you should create a Pull Request to your repo. (Don't forget
frameiterator
to change back to1
) - Use
action/repo-checker
as your basis for checking errors and misconfiguration. - Recommended source:
Erai-Raws
,Nyaa
. - If you need help, just message us on our Facebook page. Or create an Issue/Discussion thread here.
- When using a VPS/Droplet server, just clone this repository and paste all your frames to
frames
directory, also the tokens are gonna be insecret.sh
file.
Warning
We're not responsible whatever happens to your Facebook account. Just to be safe, I prefer using an dedicated account for the page, else you can use your main but use it with care. Use at your own risk
+ All PR's are now welcome!! +
If you have ideas or fixes to the bugs and also improving the codes, Feel free to Contribute! 😉