Exceptions
FacebookGqlScraperException
Base class for all errors raised by this library.
Session errors
SessionExpiredError: ExceptionFacebook invalidated the session — cookies expired or were revoked.
InheritsFacebookGqlScraperException.
GraphQL request errors
SchemaChangedError: ExceptionFacebook changed the GraphQL schema for an operation; the variables no longer match.
InheritsFacebookGqlScraperException.DocIdStillInvalidError: ExceptionFacebook rejected the doc_id even after re-discovery.
InheritsFacebookGqlScraperException.DtsgTokenStillInvalidError: ExceptionFacebook rejected the fb_dtsg token even after refresh.
InheritsFacebookGqlScraperException.DtsgTokenFetchError: ExceptionFailed to obtain the fb_dtsg token.
InheritsFacebookGqlScraperException.
Not found errors
FacebookNotFoundError: ExceptionBase for not-found errors. The requested resource does not exist on Facebook.
InheritsFacebookGqlScraperException.ProfileNotFoundError: ExceptionThe profile was not found.
InheritsFacebookNotFoundError.PostNotFoundError: ExceptionThe post was not found.
InheritsFacebookNotFoundError.GroupNotFoundError: ExceptionThe group was not found.
InheritsFacebookNotFoundError.MarketplaceListingNotFoundError: ExceptionThe Marketplace listing was not found.
InheritsFacebookNotFoundError.
Access errors
FacebookAccessException: ExceptionBase for access errors. Facebook refused access to the requested resource.
InheritsFacebookGqlScraperException.ResourceNotAvailableException: ExceptionThe resource exists but is not exposed by this profile or group.
InheritsFacebookAccessException.FollowersNotAvailableException: ExceptionThe profile does not expose its followers list.
InheritsResourceNotAvailableException.FolloweesNotAvailableException: ExceptionThe profile does not expose its following list.
InheritsResourceNotAvailableException.FriendFollowersNotAvailableException: ExceptionThe profile does not expose friends with follower relationships.
InheritsResourceNotAvailableException.FriendFolloweesNotAvailableException: ExceptionThe profile does not expose friends with following relationships.
InheritsResourceNotAvailableException.PhotoNotAvailableException: ExceptionThe profile does not expose its photos.
InheritsResourceNotAvailableException.ReelsNotAvailableException: ExceptionThe profile does not expose its reels.
InheritsResourceNotAvailableException.
Usage errors
MissingParentError: ExceptionA model needs its parent, but none was provided — e.g.
Comment.get_replies()without a parentPost.
InheritsFacebookGqlScraperException.
Example
import facebook_gql_scraper as fgs
from facebook_gql_scraper.exceptions import ProfileNotFoundError
context = fgs.FacebookContext(cookies_file="facebook_cookies.json")
try:
user = fgs.Profile.from_username(context, username="doesnotexist123")
except ProfileNotFoundError:
print("No such profile")