socialapis-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- socialapis_sdk-0.1.0/.gitignore +218 -0
- socialapis_sdk-0.1.0/CHANGELOG.md +92 -0
- socialapis_sdk-0.1.0/LICENSE +21 -0
- socialapis_sdk-0.1.0/PKG-INFO +319 -0
- socialapis_sdk-0.1.0/README.md +281 -0
- socialapis_sdk-0.1.0/pyproject.toml +185 -0
- socialapis_sdk-0.1.0/socialapis/__init__.py +111 -0
- socialapis_sdk-0.1.0/socialapis/_account.py +153 -0
- socialapis_sdk-0.1.0/socialapis/_client.py +167 -0
- socialapis_sdk-0.1.0/socialapis/_errors.py +97 -0
- socialapis_sdk-0.1.0/socialapis/_version.py +7 -0
- socialapis_sdk-0.1.0/socialapis/facebook/__init__.py +23 -0
- socialapis_sdk-0.1.0/socialapis/facebook/_client.py +975 -0
- socialapis_sdk-0.1.0/socialapis/facebook/_types.py +75 -0
- socialapis_sdk-0.1.0/socialapis/instagram/__init__.py +15 -0
- socialapis_sdk-0.1.0/socialapis/instagram/_client.py +415 -0
- socialapis_sdk-0.1.0/socialapis/instagram/_types.py +42 -0
- socialapis_sdk-0.1.0/socialapis/py.typed +0 -0
- socialapis_sdk-0.1.0/tests/__init__.py +0 -0
- socialapis_sdk-0.1.0/tests/test_account.py +53 -0
- socialapis_sdk-0.1.0/tests/test_aliases.py +52 -0
- socialapis_sdk-0.1.0/tests/test_facebook.py +267 -0
- socialapis_sdk-0.1.0/tests/test_instagram.py +86 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] — Unreleased
|
|
9
|
+
|
|
10
|
+
First public release. Full coverage of the SocialAPIs.io public REST surface
|
|
11
|
+
in one shot — no v0.2/v0.3 follow-ups required for core endpoints.
|
|
12
|
+
|
|
13
|
+
> **PyPI distribution name**: `socialapis-sdk` (install with
|
|
14
|
+
> `pip install socialapis-sdk`). The Python import path is the
|
|
15
|
+
> shorter `socialapis` (`from socialapis import Facebook`) — those
|
|
16
|
+
> two are independent on PyPI.
|
|
17
|
+
|
|
18
|
+
### Added — Facebook namespace (`Facebook` / `AsyncFacebook`)
|
|
19
|
+
|
|
20
|
+
**Pages**: `get_page_id`, `get_page_info`, `get_page_posts`, `get_page_reels`,
|
|
21
|
+
`get_page_videos`
|
|
22
|
+
|
|
23
|
+
**Groups**: `get_group_id`, `get_group_details`, `get_group_metadata`,
|
|
24
|
+
`get_group_posts`, `get_group_videos`
|
|
25
|
+
|
|
26
|
+
**Posts**: `get_post_id`, `get_post_details`, `get_post_details_extended`,
|
|
27
|
+
`get_post_comments`, `get_comment_replies`, `get_post_attachments`,
|
|
28
|
+
`get_video_post_details`
|
|
29
|
+
|
|
30
|
+
**Search**: `search_pages`, `search_people`, `search_locations`,
|
|
31
|
+
`search_posts`, `search_videos`
|
|
32
|
+
|
|
33
|
+
**Meta Ads Library**: `get_ads_countries`, `search_ads`,
|
|
34
|
+
`get_ads_page_details`, `get_ad_archive_details`, `search_ads_by_keywords`
|
|
35
|
+
|
|
36
|
+
**Marketplace**: `search_marketplace`, `get_listing_details`,
|
|
37
|
+
`get_seller_details`, `get_marketplace_categories`, `get_city_coordinates`,
|
|
38
|
+
`search_vehicles`, `search_rentals`
|
|
39
|
+
|
|
40
|
+
**Media**: `download_media`
|
|
41
|
+
|
|
42
|
+
### Added — Instagram namespace (`Instagram` / `AsyncInstagram`)
|
|
43
|
+
|
|
44
|
+
**Profiles**: `get_user_id`, `get_profile_details`, `get_profile_posts`,
|
|
45
|
+
`get_profile_reels`, `get_profile_highlights`, `get_highlight_details`
|
|
46
|
+
|
|
47
|
+
**Posts**: `get_post_id`, `get_post_details`
|
|
48
|
+
|
|
49
|
+
**Reels**: `get_reels_feed`, `get_reels_by_audio`
|
|
50
|
+
|
|
51
|
+
**Search + Locations**: `search`, `get_location_posts`,
|
|
52
|
+
`get_nearby_locations`
|
|
53
|
+
|
|
54
|
+
### Added — Account namespace (`Account` / `AsyncAccount`)
|
|
55
|
+
|
|
56
|
+
`get_usage`, `get_top_ups`, `get_limits`. All free (don't consume credits).
|
|
57
|
+
|
|
58
|
+
### Added — Infrastructure
|
|
59
|
+
|
|
60
|
+
- Typed exception hierarchy (`SocialAPIsError`, `APIError`,
|
|
61
|
+
`AuthenticationError`, `InsufficientCreditsError`, `RateLimitError`,
|
|
62
|
+
`BadRequestError`, `APIServerError`, `APIConnectionError`)
|
|
63
|
+
- Pydantic v2 response models for headline endpoints (`PageInfo`,
|
|
64
|
+
`GroupInfo`, `ProfileInfo`). Niche endpoints return `dict[str, Any]`
|
|
65
|
+
with full data preserved.
|
|
66
|
+
- Sync + async context-manager support (`with` / `async with`)
|
|
67
|
+
- Identifier normalisation — pass either a slug or a full URL; the SDK
|
|
68
|
+
coerces to whatever shape the API expects
|
|
69
|
+
- `**kwargs` pass-through on every method — forward-compatible when the
|
|
70
|
+
API adds new filters; no client release needed to use them
|
|
71
|
+
- No `limit=N` parameters anywhere — the API decides page size; pagination
|
|
72
|
+
is cursor-driven via response body + kwargs
|
|
73
|
+
|
|
74
|
+
### Added — Migration aliases (graveyard capture)
|
|
75
|
+
|
|
76
|
+
- `FacebookScraper` / `AsyncFacebookScraper` — exact aliases of
|
|
77
|
+
`Facebook` / `AsyncFacebook`. Lets users of the abandoned
|
|
78
|
+
`kevinzg/facebook-scraper` library migrate by changing only the import.
|
|
79
|
+
- `InstagramScraper` / `AsyncInstagramScraper` — same for users of
|
|
80
|
+
`arc298/instagram-scraper`.
|
|
81
|
+
- `test_aliases.py` asserts the identity contract so accidental
|
|
82
|
+
decoupling fails CI.
|
|
83
|
+
|
|
84
|
+
### Added — Tooling
|
|
85
|
+
|
|
86
|
+
- `pyproject.toml` with hatchling, modern Python (3.10+), no `setup.py`
|
|
87
|
+
- Test suite using `respx` for HTTP mocking (no live API calls in CI)
|
|
88
|
+
- CI: lint (ruff), type check (mypy --strict), tests on Python 3.10–3.13
|
|
89
|
+
- Release workflow: publishes to PyPI via Trusted Publishing on
|
|
90
|
+
`vX.Y.Z` tag (no API token to rotate)
|
|
91
|
+
- PEP 561 `py.typed` marker — distributed type hints
|
|
92
|
+
- Coverage gate at 85% in CI
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SocialAPIsHub
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: socialapis-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Facebook and Instagram public data. Drop-in replacement for facebook-scraper. REST + MCP, 200 free API calls/month, no OAuth.
|
|
5
|
+
Project-URL: Homepage, https://socialapis.io
|
|
6
|
+
Project-URL: Documentation, https://docs.socialapis.io
|
|
7
|
+
Project-URL: Repository, https://github.com/SocialAPIsHub/socialapis-python
|
|
8
|
+
Project-URL: Issues, https://github.com/SocialAPIsHub/socialapis-python/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/SocialAPIsHub/socialapis-python/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: SocialAPIs <pypi@socialapis.io>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: ai-agents,data-extraction,facebook,facebook-api,facebook-graph-api-alternative,facebook-scraper,instagram,instagram-api,instagram-scraper,mcp,meta-api,scraping,social-media,social-media-api
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Requires-Dist: httpx>=0.27
|
|
29
|
+
Requires-Dist: pydantic>=2.5
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
35
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# socialapis — Python SDK for Facebook + Instagram public data
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/socialapis-sdk/)
|
|
42
|
+
[](https://pypi.org/project/socialapis-sdk/)
|
|
43
|
+
[](LICENSE)
|
|
44
|
+
|
|
45
|
+
The modern alternative to [`kevinzg/facebook-scraper`](https://github.com/kevinzg/facebook-scraper)
|
|
46
|
+
and [`arc298/instagram-scraper`](https://github.com/arc298/instagram-scraper) —
|
|
47
|
+
real-time Facebook + Instagram data via REST, **no OAuth dance, no app
|
|
48
|
+
review, no scraper maintenance**. Powered by hosted infrastructure at
|
|
49
|
+
[socialapis.io](https://socialapis.io).
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install socialapis-sdk
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from socialapis import Facebook, Instagram
|
|
57
|
+
|
|
58
|
+
fb = Facebook(api_token="...")
|
|
59
|
+
page = fb.get_page_info("EngenSA")
|
|
60
|
+
print(page.name, page.likes, page.category)
|
|
61
|
+
|
|
62
|
+
ig = Instagram(api_token="...")
|
|
63
|
+
profile = ig.get_profile_details("instagram")
|
|
64
|
+
print(profile.username, profile.followers)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**[Get a free API token →](https://socialapis.io/auth/signup)** — 200 calls/month, no credit card
|
|
68
|
+
|
|
69
|
+
## One-line migration
|
|
70
|
+
|
|
71
|
+
If your code currently uses [`kevinzg/facebook-scraper`](https://github.com/kevinzg/facebook-scraper)
|
|
72
|
+
or [`arc298/instagram-scraper`](https://github.com/arc298/instagram-scraper), the migration is
|
|
73
|
+
**literally one import line**:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
# Before — kevinzg/facebook-scraper (abandoned since 2022)
|
|
77
|
+
from facebook_scraper import get_page_info, get_posts
|
|
78
|
+
|
|
79
|
+
# After — socialapis (alias preserves the name)
|
|
80
|
+
from socialapis import FacebookScraper
|
|
81
|
+
fb = FacebookScraper(api_token="...")
|
|
82
|
+
fb.get_page_info("EngenSA")
|
|
83
|
+
fb.get_page_posts("EngenSA")
|
|
84
|
+
|
|
85
|
+
# Same for Instagram
|
|
86
|
+
from socialapis import InstagramScraper
|
|
87
|
+
ig = InstagramScraper(api_token="...")
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`FacebookScraper` and `InstagramScraper` are exact aliases of `Facebook` and `Instagram` —
|
|
91
|
+
identical behavior, identical type signatures. They exist purely to keep the import
|
|
92
|
+
line greppable during migration.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Why this exists
|
|
97
|
+
|
|
98
|
+
`kevinzg/facebook-scraper` has 9.5k+ GitHub stars and was the default Python library for
|
|
99
|
+
scraping Facebook for years. It's been **abandoned since 2022**. `arc298/instagram-scraper`
|
|
100
|
+
(8.5k stars) is in similar shape. Every Meta DOM change breaks them; fixes pile up in
|
|
101
|
+
unmerged PRs; downloads drift to forks that fix one bug and break two.
|
|
102
|
+
|
|
103
|
+
This SDK is the **drop-in successor**:
|
|
104
|
+
|
|
105
|
+
| | `kevinzg/facebook-scraper` (2018-era) | `socialapis` (2026) |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| **Maintenance** | Abandoned 2022 | Active; we run prod for 7M+ calls/mo |
|
|
108
|
+
| **Reliability** | Breaks on every Meta HTML change | Hosted backend; we absorb breakage |
|
|
109
|
+
| **Type hints** | None | Strict throughout |
|
|
110
|
+
| **Async support** | No | `Facebook` + `AsyncFacebook` classes |
|
|
111
|
+
| **HTTP client** | `requests` | `httpx` |
|
|
112
|
+
| **Validation** | Manual dict parsing | Pydantic v2 models |
|
|
113
|
+
| **Auth** | None (scrapes anonymously) | Single `x-api-token` header |
|
|
114
|
+
| **Pagination** | Generator with edge-case bugs | Cursor-based; API decides page size |
|
|
115
|
+
| **Error handling** | Generic exceptions | Typed hierarchy (`RateLimitError`, etc.) |
|
|
116
|
+
| **CI / tests** | Manual against live FB | Recorded HTTP fixtures, Python 3.10–3.13 |
|
|
117
|
+
| **Coverage** | Page posts, group posts only | **45+ endpoints** across FB + IG |
|
|
118
|
+
|
|
119
|
+
The trade-off: instead of running a scraper yourself, you make a REST call to our hosted
|
|
120
|
+
API. **200 calls/month free**, no credit card. Paid plans start at $4.99/mo for 1,500
|
|
121
|
+
calls.
|
|
122
|
+
|
|
123
|
+
## What's covered (v0.1)
|
|
124
|
+
|
|
125
|
+
### Facebook (`Facebook` / `AsyncFacebook`)
|
|
126
|
+
|
|
127
|
+
**Pages**
|
|
128
|
+
- `get_page_id(page)` — resolve a URL/slug to numeric ID
|
|
129
|
+
- `get_page_info(page)` → `PageInfo` — page metadata (typed model)
|
|
130
|
+
- `get_page_posts(page)` — recent posts
|
|
131
|
+
- `get_page_reels(page)` — short-form videos
|
|
132
|
+
- `get_page_videos(page)` — long-form videos
|
|
133
|
+
|
|
134
|
+
**Groups**
|
|
135
|
+
- `get_group_id(group)`
|
|
136
|
+
- `get_group_details(group)` → `GroupInfo` (typed model)
|
|
137
|
+
- `get_group_metadata(group)` — lightweight metadata only
|
|
138
|
+
- `get_group_posts(group)`
|
|
139
|
+
- `get_group_videos(group_id)`
|
|
140
|
+
|
|
141
|
+
**Posts**
|
|
142
|
+
- `get_post_id(post)` — extract numeric ID from URL
|
|
143
|
+
- `get_post_details(post)` — reactions, media, author
|
|
144
|
+
- `get_post_details_extended(post)` — + views, video URLs, author verification
|
|
145
|
+
- `get_post_comments(post)` — pass `include_reply_info="true"` for reply cursors
|
|
146
|
+
- `get_comment_replies(comment_feedback_id, expansion_token)`
|
|
147
|
+
- `get_post_attachments(post_id)`
|
|
148
|
+
- `get_video_post_details(video_id)`
|
|
149
|
+
|
|
150
|
+
**Search**
|
|
151
|
+
- `search_pages(query)` — supports `location_id` for geo-filtering
|
|
152
|
+
- `search_people(query)`
|
|
153
|
+
- `search_locations(query)` — returns location IDs for use in other endpoints
|
|
154
|
+
- `search_posts(query)` — supports recency + location filters
|
|
155
|
+
- `search_videos(query)`
|
|
156
|
+
|
|
157
|
+
**Meta Ads Library**
|
|
158
|
+
- `get_ads_countries()` — supported countries
|
|
159
|
+
- `search_ads(query)` — by keyword + country + activeStatus
|
|
160
|
+
- `get_ads_page_details(page_id)`
|
|
161
|
+
- `get_ad_archive_details(ad_archive_id, page_id)`
|
|
162
|
+
- `search_ads_by_keywords(query)`
|
|
163
|
+
|
|
164
|
+
**Marketplace**
|
|
165
|
+
- `search_marketplace(query)` — supports lat/lng, price, condition filters
|
|
166
|
+
- `get_listing_details(listing_id)`
|
|
167
|
+
- `get_seller_details(seller_id)`
|
|
168
|
+
- `get_marketplace_categories()`
|
|
169
|
+
- `get_city_coordinates(city)` — for lat/lng filtering
|
|
170
|
+
- `search_vehicles()` — bedrooms-style filters; lat/lng required
|
|
171
|
+
- `search_rentals()`
|
|
172
|
+
|
|
173
|
+
**Media**
|
|
174
|
+
- `download_media(url)` — resolve to direct downloadable URL
|
|
175
|
+
|
|
176
|
+
### Instagram (`Instagram` / `AsyncInstagram`)
|
|
177
|
+
|
|
178
|
+
**Profiles**
|
|
179
|
+
- `get_user_id(profile)` — username/URL → numeric user_id
|
|
180
|
+
- `get_profile_details(username)` → `ProfileInfo` (typed model)
|
|
181
|
+
- `get_profile_posts(username)`
|
|
182
|
+
- `get_profile_reels(user_id)`
|
|
183
|
+
- `get_profile_highlights(user_id)`
|
|
184
|
+
- `get_highlight_details(highlight_id)`
|
|
185
|
+
|
|
186
|
+
**Posts**
|
|
187
|
+
- `get_post_id(post)` — extract shortcode from any post URL
|
|
188
|
+
- `get_post_details(shortcode)`
|
|
189
|
+
|
|
190
|
+
**Reels**
|
|
191
|
+
- `get_reels_feed()` — trending feed
|
|
192
|
+
- `get_reels_by_audio(audio_id)` — all reels using a specific track
|
|
193
|
+
|
|
194
|
+
**Search + Locations**
|
|
195
|
+
- `search(keyword)` — popular results (users / hashtags / places)
|
|
196
|
+
- `get_location_posts(location_id)` — top or recent
|
|
197
|
+
- `get_nearby_locations(location_id)`
|
|
198
|
+
|
|
199
|
+
### Account (`Account` / `AsyncAccount`)
|
|
200
|
+
|
|
201
|
+
Free calls — don't consume credits.
|
|
202
|
+
|
|
203
|
+
- `get_usage()` — credit balance, plan, billing period
|
|
204
|
+
- `get_top_ups()` — auto top-up settings + history
|
|
205
|
+
- `get_limits()` — rate limit, concurrent-task cap, allowed packages
|
|
206
|
+
|
|
207
|
+
## Pagination — no `limit=N`, just cursors
|
|
208
|
+
|
|
209
|
+
Every endpoint that returns a list lets the API decide page size. To paginate, take the
|
|
210
|
+
cursor from the response body and pass it back as a kwarg on the next call:
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
fb = Facebook(api_token="...")
|
|
214
|
+
|
|
215
|
+
# First page
|
|
216
|
+
result = fb.get_page_posts("EngenSA")
|
|
217
|
+
posts = result["posts"]
|
|
218
|
+
cursor = result.get("next_cursor") # actual key varies by endpoint — check docs
|
|
219
|
+
|
|
220
|
+
# Next page
|
|
221
|
+
while cursor:
|
|
222
|
+
result = fb.get_page_posts("EngenSA", cursor=cursor)
|
|
223
|
+
posts.extend(result["posts"])
|
|
224
|
+
cursor = result.get("next_cursor")
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
We deliberately don't impose a uniform `limit=N` parameter — it would drift from the
|
|
228
|
+
API's actual semantics. The API's response always tells you whether there's more.
|
|
229
|
+
|
|
230
|
+
## Forward-compat via `**kwargs`
|
|
231
|
+
|
|
232
|
+
Every method accepts arbitrary kwargs and forwards them as query params. If the API adds
|
|
233
|
+
a new filter tomorrow, you can use it today — no SDK release required:
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
fb.search_ads("fitness", country="US", activeStatus="Active", some_new_filter="x")
|
|
237
|
+
# Sends: ?query=fitness&country=US&activeStatus=Active&some_new_filter=x
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Error handling
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
import time
|
|
244
|
+
from socialapis import (
|
|
245
|
+
Facebook,
|
|
246
|
+
AuthenticationError, # 401 — bad token
|
|
247
|
+
InsufficientCreditsError, # 402 — out of credits
|
|
248
|
+
RateLimitError, # 429 — slow down
|
|
249
|
+
BadRequestError, # 4xx — bad input
|
|
250
|
+
APIServerError, # 5xx — retry safely
|
|
251
|
+
APIConnectionError, # network — retry with backoff
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
fb = Facebook(api_token="...")
|
|
255
|
+
try:
|
|
256
|
+
page = fb.get_page_info("EngenSA")
|
|
257
|
+
except RateLimitError as exc:
|
|
258
|
+
time.sleep(exc.retry_after_seconds or 5)
|
|
259
|
+
page = fb.get_page_info("EngenSA")
|
|
260
|
+
except InsufficientCreditsError:
|
|
261
|
+
print("Out of credits. Upgrade at https://socialapis.io/pricing")
|
|
262
|
+
except AuthenticationError:
|
|
263
|
+
print("Bad token. Get one at https://socialapis.io/auth/signup")
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Every typed exception carries `.status_code`, `.request_id`, and `.body` for debugging.
|
|
267
|
+
The `request_id` is the same value our backend logs — paste it into a support email
|
|
268
|
+
and we can find the exact call.
|
|
269
|
+
|
|
270
|
+
## Async
|
|
271
|
+
|
|
272
|
+
Same method surface; methods are coroutines.
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
import asyncio
|
|
276
|
+
from socialapis import AsyncFacebook
|
|
277
|
+
|
|
278
|
+
async def main():
|
|
279
|
+
async with AsyncFacebook(api_token="...") as fb:
|
|
280
|
+
pages = await asyncio.gather(*[
|
|
281
|
+
fb.get_page_info(slug)
|
|
282
|
+
for slug in ["EngenSA", "Microsoft", "GitHub"]
|
|
283
|
+
])
|
|
284
|
+
for page in pages:
|
|
285
|
+
print(page.name, page.followers)
|
|
286
|
+
|
|
287
|
+
asyncio.run(main())
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Pricing
|
|
291
|
+
|
|
292
|
+
| Tier | Calls / month | Price |
|
|
293
|
+
|---|---|---|
|
|
294
|
+
| **Free** | 200 | $0 |
|
|
295
|
+
| Pro | 1,500 | $4.99 |
|
|
296
|
+
| Ultra | 30,000 | $49 |
|
|
297
|
+
| Mega | 120,000 | $179 |
|
|
298
|
+
| Enterprise | Custom | [Contact us](https://socialapis.io/contact-us) |
|
|
299
|
+
|
|
300
|
+
One credit per successful response. Failed calls (4xx caused by bad input) don't
|
|
301
|
+
consume credits.
|
|
302
|
+
|
|
303
|
+
## Other languages
|
|
304
|
+
|
|
305
|
+
- **JavaScript / TypeScript** — coming soon. [Notify me →](https://socialapis.io/api-sources)
|
|
306
|
+
- **PHP** — coming soon. [Notify me →](https://socialapis.io/api-sources)
|
|
307
|
+
- **Go** — coming soon. [Notify me →](https://socialapis.io/api-sources)
|
|
308
|
+
- Any language right now: hit the REST API directly with `curl` / `fetch` / `requests`. Docs at [docs.socialapis.io](https://docs.socialapis.io).
|
|
309
|
+
|
|
310
|
+
## Support
|
|
311
|
+
|
|
312
|
+
- Docs: [docs.socialapis.io](https://docs.socialapis.io)
|
|
313
|
+
- Issues: [github.com/SocialAPIsHub/socialapis-python/issues](https://github.com/SocialAPIsHub/socialapis-python/issues)
|
|
314
|
+
- Email: [support@socialapis.io](mailto:support@socialapis.io)
|
|
315
|
+
- Telegram (fastest): [t.me/socialapis](https://t.me/socialapis)
|
|
316
|
+
|
|
317
|
+
## License
|
|
318
|
+
|
|
319
|
+
MIT — see [LICENSE](LICENSE).
|