GHunt
GHunt copied to clipboard
[Bug] Some Profile Pictures are not shown when an account with multiple profile photos are specified.
Describe the bug
Looks like the result lacks some of the profile photos when the account with multiple profile photos are specified.
To Reproduce
Try ghunt email [email protected]
You will get followings.
[+] Custom profile picture !
=> https://lh3.googleusercontent.com/cm/AOgkWRadPfpfwkMtuZiCMmCUbeUgB-fKemZhlgQb4O-vCiMyf0UZ85t5Jvy65fT2Xy8
🎭 No face detected.
[-] Default cover picture
However, my main profile photo are this... https://lh3.googleusercontent.com/a-/ALV-UjVAZwNswrR856p1RmOX9FTFMgS7l9Hrj6qguQwFry_szec
Investigation
I referred to the corresponding source code for getting the profile photo.
https://github.com/mxrch/GHunt/blob/e87346963658dd8d80cef49dbf1bd263e96d352e/ghunt/apis/peoplepa.py#L33-L106
printed out the data
and got this.
{'matches': [{'lookupId': '[email protected]', 'personId': ['107694920401573579556']}], 'people': {'107694920401573579556': {'personId': '107694920401573579556', 'metadata': {'ownerId': '107694920401573579556', 'objectType': 'PERSON', 'contactId': ['5109819430929386011'], 'inViewerDomain': False, 'ownerUserType': ['GOOGLE_USER'], 'lastUpdateTimeMicros': '1704909803193', 'identityInfo': {'originalLookupToken': ['[email protected]'], 'sourceIds': [{'container': 'PROFILE', 'id': '107694920401573579556', 'lastUpdatedMicros': '1704909803193055', 'sourceEtag': '#55oD9Qu79Ow=', 'containerType': 'PROFILE', 'lastUpdated': '2024-01-10T18:03:23.193055Z'}, {'container': 'CONTACT', 'id': '46e9b9b30eef4a1b', 'lastUpdatedMicros': '1504564690767001', 'sourceEtag': '#EW59UGzhbok=', 'containerType': 'CONTACT', 'lastUpdated': '2017-09-04T22:38:10.767001Z'}]}, 'bestDisplayName': {'displayName': '市川 詩恩', 'displayNameLastFirst': '市川詩恩', 'containerType': 'CONTACT'}, 'model': 'PROFILE_CENTRIC'}, 'name': [{'metadata': {'writeable': True, 'container': 'CONTACT', 'primary': True, 'containerId': '5109819430929386011', 'encodedContainerId': '46e9b9b30eef4a1b', 'containerType': 'CONTACT'}, 'displayName': '市川 詩恩', 'givenName': '詩恩', 'familyName': '市川', 'displayNameLastFirst': '市川詩恩', 'unstructuredName': '市川 詩恩'}, {'metadata': {'container': 'PROFILE', 'encodedContainerId': '107694920401573579556', 'containerPrimary': True, 'containerType': 'PROFILE'}, 'displayName': 'Shion Ichikawa', 'givenName': 'Shion', 'familyName': 'Ichikawa', 'displayNameLastFirst': 'Ichikawa, Shion', 'unstructuredName': 'Shion Ichikawa'}], 'photo': [{'metadata': {'container': 'PROFILE', 'primary': True, 'visibility': 'PUBLIC', 'encodedContainerId': '107694920401573579556', 'containerType': 'PROFILE'}, 'url': 'https://lh3.googleusercontent.com/a-/ALV-UjVAZwNswrR856p1RmOX9FTFMgS7l9Hrj6qguQwFry_szec', 'photoToken': 'EhUxMDc2OTQ5MjA0MDE1NzM1Nzk1NTYoATCd4v2__f____8B'}, {'metadata': {'writeable': True, 'container': 'CONTACT', 'containerId': '5109819430929386011', 'encodedContainerId': '46e9b9b30eef4a1b', 'containerType': 'CONTACT'}, 'url': 'https://lh3.googleusercontent.com/cm/AOgkWRadPfpfwkMtuZiCMmCUbeUgB-fKemZhlgQb4O-vCiMyf0UZ85t5Jvy65fT2Xy8', 'isDefault': True, 'photoToken': 'EhA0NmU5YjliMzBlZWY0YTFiKAIw48uZ1QQ=', 'isMonogram': True, 'monogramBackground': 'C2185B'}], 'email': [{'metadata': {'writeable': True, 'container': 'CONTACT', 'primary': True, 'edgeKey': True, 'containerId': '5109819430929386011', 'encodedContainerId': '46e9b9b30eef4a1b', 'containerPrimary': True, 'edgeKeyInfo': [{'containerId': '107694920401573579556', 'containerType': 'PROFILE', 'materialized': True}], 'containerType': 'CONTACT'}, 'value': '[email protected]'}, {'metadata': {'container': 'PROFILE', 'encodedContainerId': '107694920401573579556', 'containerType': 'PROFILE'}, 'value': '[email protected]', 'extendedData': {'isPlaceholder': True}}], 'sortKeys': {'name': '3zeSqEeQvEkyYEer8--', 'lastName': '3zeSqEeQvEkyYEer8--', 'nameRaw': '0市川詩恩', 'lastNameRaw': '0市川詩恩'}, 'fingerprint': '%EhEBAgMJGRseICssLjY3ODk7ZBoJAQIDBQYHCAkLIgxFVzU5VUd6aGJvaz0=', 'coverPhoto': [{'imageUrl': 'https://lh3.googleusercontent.com/c5dqxl-2uHZ82ah9p7yxrVF1ZssrJNSV_15Nu0TUZwzCWqmtoLxCUJgEzLGtxsrJ6-v6R6rKU_-FYm881TTiMCJ_=s1600', 'isDefault': True, 'metadata': {'container': 'PROFILE', 'primary': True, 'visibility': 'PUBLIC', 'encodedContainerId': '107694920401573579556', 'containerType': 'PROFILE'}}], 'inAppReachability': [{'metadata': {'container': 'PROFILE', 'visibility': 'PUBLIC', 'encodedContainerId': '107694920401573579556', 'containerType': 'PROFILE'}, 'appType': 'YOUTUBE', 'status': 'REACHABLE', 'reachabilityKey': {'keyType': 'OBFUSCATED_GAIA_ID', 'keyValue': '107694920401573579556'}}, {'metadata': {'container': 'PROFILE', 'visibility': 'PUBLIC', 'encodedContainerId': '107694920401573579556', 'containerType': 'PROFILE'}, 'appType': 'PHOTOS', 'status': 'REACHABLE', 'reachabilityKey': {'keyType': 'OBFUSCATED_GAIA_ID', 'keyValue': '107694920401573579556'}}, {'metadata': {'container': 'PROFILE', 'visibility': 'PUBLIC', 'encodedContainerId': '107694920401573579556', 'containerType': 'PROFILE'}, 'appType': 'MAPS', 'status': 'REACHABLE', 'reachabilityKey': {'keyType': 'OBFUSCATED_GAIA_ID', 'keyValue': '107694920401573579556'}}], 'extendedData': {'dynamiteExtendedData': {'presence': 'UNKNOWN', 'entityType': 'PERSON', 'dndState': 'AVAILABLE', 'organizationInfo': {'consumerInfo': {}}}}, 'readOnlyProfileInfo': [{'metadata': {'container': 'PROFILE', 'encodedContainerId': '107694920401573579556', 'containerType': 'PROFILE'}, 'ownerId': '107694920401573579556', 'ownerUserType': ['GOOGLE_USER'], 'inViewerDomain': False}]}}}
I see the profile photo link I was expecting on ['people']['107694920401573579556']['photo'][0]. So looks like this is just a parsing problem.
Good catch, thanks ! I'll deploy a fix soon.
https://github.com/mxrch/GHunt/commit/7d117a3ecce67658f8f09b8dd944669c4f5c6356
https://github.com/mxrch/GHunt/commit/96e78c01546372e6b8d761772daa6b2694bd0584
maybe it fix the glitch
Hey, I cannot reproduce this bug. I see you have two containers in your response : the PROFILE and CONTACT, and for an unknown reason, for you, it takes the CONTACT container to show the picture, despite that I hardcoded the PROFILE container there :
https://github.com/mxrch/GHunt/blob/e87346963658dd8d80cef49dbf1bd263e96d352e/ghunt/modules/email.py#L48-L59
Did you type my email? ( [email protected]
)
I've upgraded to ghunt to the latest version, but still getting the same result.
I'll work on this issue.
@mxrch
I've noticed an issue where the first image's data is being overwritten by the second image's data when loading two photos. This occurs due to profile_data["metadata"]["container"]
having the same value (PROFILE
) for both images, as seen in the code at ghunt/parsers/people.py#L148-L151.
https://github.com/mxrch/GHunt/blob/40018b7f414b3c45c94b5d753ca12cdaffd5bfc7/ghunt/parsers/people.py#L148-L151
I propose two potential solutions:
-
Change
Person.profilePhotos
toDict[str, list[PersonPhoto]]
: Given that both profile photos use thePROFILE
key, we could store both images by converting the value to a list. This approach is less disruptive to the existing code structure. -
Change
Person.profilePhotos
tolist[PersonPhoto]
: Since all profile images use thePROFILE
key, converting this field to a list simplifies the structure. While this method is more straightforward, it is also more invasive and may reduce flexibility in accommodating future changes from Google.
I lean towards the second option for its simplicity and clarity, but it does come with the risk of reduced adaptability. I need the maintainer's opinion.