A professional Python tool for encoding and decoding Facebook API parameters.
This project implements a reverse-engineered compression algorithm used by Facebook (BitMap + Run-Length Encoding + Custom Base64) to manage critical API parameters. It allows you to generate 100% valid and authentic-looking request payloads.
- Universal Support: Fully compatible with all parameters utilizing BitMap techniques:
__dyn(Dynamic Loaded Modules)__csr(Client Side Resources / CSS)__hsdp(HTML Server Data Parameter)__hblp(HTML BigPipe Last Parameter)__sjsp(Server JS Parameter)
- Reversible Logic: Seamlessly converts between raw IDs and encoded strings with zero data loss.
- Safety Filter: Built-in protection against memory overflow errors by automatically filtering out invalid or excessively large IDs (e.g., timestamps).
- Clean & Professional: Implemented as a clean, easy-to-use Python class (
FacebookCodec) with type hinting support.
-
Clone this repository to your local machine:
git clone https://github.com/NiceDayZc/FacebookCodec.git cd FacebookCodec -
Ensure that
FCodec.pyis present in your project directory.
Simply import the FacebookCodec class from FCodec.py to get started.
Use this to generate parameters like __dyn or __csr for your API requests.
from FCodec import FacebookCodec
# Initialize the codec
codec = FacebookCodec()
# Example list of IDs (e.g., extracted from 'rsrcMap' in HTML)
js_modules = [17, 25, 30, 100, 101, 102, 500]
# Generate the encoded string
dyn_value = codec.encode(js_modules)
print(f"Generated __dyn: {dyn_value}")
# Output: 7xeUjGU... (Ready-to-use string)