NicklasWallgren / instagram-api

Instagram Private API
MIT License
148 stars 46 forks source link

Get Contact Email of User/s #54

Open foxconier opened 3 years ago

foxconier commented 3 years ago

Is it possible to implement the function for getting the value of Contact Button?

NicklasWallgren commented 3 years ago

It's possible, the raw response from the api includes additional fields such as contact information, but the information is not exposed in the Instagram\SDK\Response\DTO\General\User class. A PR is welcome.

foxconier commented 3 years ago

Can you please explain me which files the need to extend for expose that stuff?

thanks

NicklasWallgren commented 3 years ago

The raw response for $instagram->userByName('dogsofinstagram'); looks like below.

You need to extend Instagram\SDK\Response\DTO\General\User with additional fields, like for example $publicEmail or $publicPhoneNumber, and then expose them via getters.

{
   "user":{
      "pk":6412892,
      "username":"dogsofinstagram",
      "full_name":"DogsOf",
      "is_private":false,
      "profile_pic_url":"https://scontent-arn2-1.cdninstagram.com/v/t51.2885-19/s150x150/234524291_354914276123790_1991693964002307724_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com\u0026_nc_ohc=AIRhmFxw8U0AX9EP-5I\u0026edm=AKralEIBAAAA\u0026ccb=7-4\u0026oh=b929bea21bc88fa25286af8dd917c043\u0026oe=6124B366\u0026_nc_sid=5e3072",
      "profile_pic_id":"2636680730290433628_6412892",
      "is_verified":true,
      "follow_friction_type":0,
      "has_anonymous_profile_picture":false,
      "media_count":6895,
      "follower_count":4995179,
      "following_count":459,
      "following_tag_count":0,
      "biography":"Bringing together the dogs of Instagram 🐾 \nLink in bio ⤵️",
      "external_url":"https://compiled.social/dogsofinstagram",
      "external_lynx_url":"https://l.instagram.com/?u=https%3A%2F%2Fcompiled.social%2Fdogsofinstagram\u0026e=ATMlLK447NfbT5qPO4yPQx5Q19CsSAYrC7Wl3a-cDCimMIWniJ6-WJ9XwFlmWS72-X9N9_pb33qfa3bcJ860\u0026s=1",
      "total_igtv_videos":4,
      "has_igtv_series":true,
      "total_clips_count":1,
      "usertags_count":2909,
      "is_favorite":false,
      "has_chaining":true,
      "hd_profile_pic_versions":[
         {
            "width":320,
            "height":320,
            "url":"https://scontent-arn2-1.cdninstagram.com/v/t51.2885-19/s320x320/234524291_354914276123790_1991693964002307724_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com\u0026_nc_ohc=AIRhmFxw8U0AX9EP-5I\u0026edm=AKralEIBAAAA\u0026ccb=7-4\u0026oh=0095fdcc14fbbf4e88ba57c3c2a75d75\u0026oe=61247A5E\u0026_nc_sid=5e3072"
         },
         {
            "width":640,
            "height":640,
            "url":"https://scontent-arn2-1.cdninstagram.com/v/t51.2885-19/s640x640/234524291_354914276123790_1991693964002307724_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com\u0026_nc_ohc=AIRhmFxw8U0AX9EP-5I\u0026edm=AKralEIBAAAA\u0026ccb=7-4\u0026oh=55aa44faf2c6898510a14a381c8c717c\u0026oe=612467A7\u0026_nc_sid=5e3072"
         }
      ],
      "hd_profile_pic_url_info":{
         "url":"https://scontent-arn2-1.cdninstagram.com/v/t51.2885-19/234524291_354914276123790_1991693964002307724_n.jpg?_nc_ht=scontent-arn2-1.cdninstagram.com\u0026_nc_ohc=AIRhmFxw8U0AX9EP-5I\u0026edm=AKralEIBAAAA\u0026ccb=7-4\u0026oh=f493f2bcb96f0a57effc635e5cc34cdb\u0026oe=6123895E\u0026_nc_sid=5e3072",
         "width":1080,
         "height":1080
      },
      "mutual_followers_count":0,
      "has_guides":false,
      "is_eligible_for_smb_support_flow":true,
      "displayed_action_button_partner":null,
      "smb_delivery_partner":null,
      "smb_support_delivery_partner":null,
      "smb_get_quote_partner":null,
      "displayed_action_button_type":"",
      "direct_messaging":"",
      "address_street":"",
      "business_contact_method":"UNKNOWN",
      "category":"Community",
      "city_id":0,
      "city_name":"",
      "contact_phone_number":"+14155287403",
      "is_call_to_action_enabled":false,
      "latitude":null,
      "longitude":null,
      "public_email":"",
      "public_phone_country_code":"1",
      "public_phone_number":"4155287403",
      "zip":"",
      "instagram_location_id":"",
      "is_business":false,
      "professional_conversion_suggested_account_type":3,
      "account_type":3,
      "can_hide_category":true,
      "can_hide_public_contacts":true,
      "should_show_category":true,
      "should_show_public_contacts":true,
      "account_badges":[

      ]
   },
   "status":"ok"
}
foxconier commented 3 years ago

Thanks

BigBalli commented 1 year ago

Is there a way to access raw responses?

wkeles commented 1 year ago

this is not working ? i need help.