diff --git a/README.md b/README.md index d3592ca..0c33027 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ from socialapis import Facebook, Instagram fb = Facebook(api_token="...") page = fb.get_page_info("EngenSA") -print(page.name, page.likes, page.category) +print(page.title, page.followers_count, page.category) ig = Instagram(api_token="...") profile = ig.get_profile_details("instagram") -print(profile.username, profile.followers) +print(profile.username, profile.followers_count) ``` **[Get a free API token →](https://socialapis.io/auth/signup)** — 200 calls/month, no credit card @@ -244,7 +244,7 @@ async def main(): for slug in ["EngenSA", "Microsoft", "GitHub"] ]) for page in pages: - print(page.name, page.followers) + print(page.title, page.followers_count) asyncio.run(main()) ``` diff --git a/examples/migrate-from-kevinzg.py b/examples/migrate-from-kevinzg.py index 010ca2f..f854d5f 100644 --- a/examples/migrate-from-kevinzg.py +++ b/examples/migrate-from-kevinzg.py @@ -61,10 +61,12 @@ def main() -> None: "Out of credits. Upgrade at https://socialapis.io/pricing" ) from None - # Same fields kevinzg returned, but now typed (page.name not page["name"]) - print(f"Page: {page.name}") + # Same data kevinzg returned, but now typed (page.title not page["name"]). + # Field names match the API exactly — see PageInfo in the SDK docs. + print(f"Page: {page.title}") print(f" Category: {page.category}") - print(f" Likes: {page.likes:,}" if page.likes else " Likes: n/a") + print(f" Likes: {page.likes_count:,}" if page.likes_count else " Likes: n/a") + print(f" Followers:{page.followers_count:,}" if page.followers_count else "") # kevinzg's `for post in get_posts(...)` equivalent — paginate via cursors result = fb.get_page_posts("EngenSA") diff --git a/examples/quickstart.py b/examples/quickstart.py index bc2fdc2..24bd13f 100644 --- a/examples/quickstart.py +++ b/examples/quickstart.py @@ -44,11 +44,11 @@ def main() -> None: page = fb.get_page_info("EngenSA") except (RateLimitError, InsufficientCreditsError) as exc: raise SystemExit(f"Facebook call failed: {exc}") from exc - print(f"Facebook page: {page.name}") + print(f"Facebook page: {page.title}") print(f" Category: {page.category}") - print(f" Likes: {page.likes:,}" if page.likes else " Likes: n/a") - print(f" Followers: {page.followers:,}" if page.followers else " Followers: n/a") - print(f" Verified: {page.verified}") + print(f" Likes: {page.likes_count:,}" if page.likes_count else " Likes: n/a") + print(f" Followers: {page.followers_count:,}" if page.followers_count else " Followers: n/a") + print(f" Bio: {(page.bio or '')[:80]}") print() # Instagram @@ -59,8 +59,12 @@ def main() -> None: raise SystemExit(f"Instagram call failed: {exc}") from exc print(f"Instagram profile: @{profile.username}") print(f" Full name: {profile.full_name}") - print(f" Followers: {profile.followers:,}" if profile.followers else " Followers: n/a") - print(f" Posts: {profile.posts_count}") + print( + f" Followers: {profile.followers_count:,}" + if profile.followers_count + else " Followers: n/a" + ) + print(f" Media: {profile.media_count}") print(f" Verified: {profile.is_verified}")