getting the data of posts from Instagram

136 views Asked by At

Hi I want to get data of a post from Instagram and return it as a json response now I don't know what is the API that should I send request to it

import requests

cookies = {
    '_ga': 'GA1.1.1059837924.1698788739',
    '_ym_uid': '1698788741797704232',
    '_ym_d': '1698788741',
    '_ym_isad': '2',
    '__gads': 'ID=1a04b6e280a7f795-    227e2de520e300ab:T=1698788741:RT=1701859645:S=ALNI_MY7HTnJbby4wHfagAIuYJyGdlnQNg',
    '__gpi': 'UID=00000cc5f497d3a7:T=1698788741:RT=1701859645:S=ALNI_MY8Nxnovq0Xrn9mtX79zuEhrFuoRw',
    'FCNEC': '%5B%5B%22AKsRol- YFpN3vMMRh8e8ayERBTIlKWOtUFJuxkZB3lSVroz1EZ3EQJhCpi9177C58h42ESeLO_e0Mj2tOpkV9D9LkStCbcgbjTPRXambPRP f9hJpOiRQoBKWvyOL7YLI93jwKbKuP_FCq1qweiJ7FK-l_MnTCtGhyw%3D%3D%22%5D%5D',
    'XSRF-TOKEN':   'eyJpdiI6IjBsQmxya3R2cFpXRGRrcldCL1NhdHc9PSIsInZhbHVlIjoiL3hURFY0Z1dHdE9sdnRBT3ZnK3RPQm1KWDgxMVhPSWl  qMkVhbjRHMGN0ajRiVU1uSitnZy9rUWxYaHZWbC9lK0hFUW1hNDA0c0pzbEpUSUJtQ2M3TnloTDlHYnVHMVplWmtOSjdkK0tMVlB  nenBGQyt3aUFYU2tUeGFJY1k4c2UiLCJtYWMiOiJiMjk3ZjNkMTBhMzU2OTMyOWNmMWY0MmZmNjllOGNlYzAyNzlmYjk0N2E1OWJ  iNzMzNmEwZjdjZjNjODFkNmMxIn0%3D',
    'laravel_session':   'eyJpdiI6ImgyRExlZG1pbWhYNVhyZHRCV2hKSGc9PSIsInZhbHVlIjoiOFpMUkZRaEhyUTM5T1NQUEtCT2NkK21ZeVl4K1lnOFF  6NklPUFMyUXp0c2Z2cWZCSUlLbW9Kci9PblRlcHhmUi9FYnNIVFF1VnpQbERtQkFRdU00SXYvWEcvNGhiTmFPYlg5L1BWUFAyNTN  NdktJMXVSZFRyTnRrSmhvdS9Ja3YiLCJtYWMiOiI4Y2I0YjI3ODgwNTYyNGVmZjJkNWQyOTgzZGU5N2YzMWMwMjNkZmNlMGMzMGI  1NTkwNmEyZTVjNjJiYmY1Mzk3In0%3D',
    '_ga_0JTJC26W3L': 'GS1.1.1701859641.8.1.1701860123.0.0.0',
}

headers = {
    'authority': 'instanavigation.com',
    'accept': 'application/json, text/plain, */*',
    'accept-language': 'en,fa-IR;q=0.9,fa;q=0.8',
    'content-type': 'application/json;charset=UTF-8',
    'cookie': '_ga=GA1.1.1059837924.1698788739; _ym_uid=1698788741797704232; _ym_d=1698788741;   _ym_isad=2; gads=ID=1a04b6e280a7f795- 227e2de520e300ab:T=1698788741:RT=1701859645:S=ALNI_MY7HTnJbby4wHfagAIuYJyGdlnQNg;  gpi=UID=00000cc5f497d3a7:T=1698788741:RT=1701859645:S=ALNI_MY8Nxnovq0Xrn9mtX79zuEhrFuoRw;  FCNEC=%5B%5B%22AKsRol-  YFpN3vMMRh8e8ayERBTIlKWOtUFJuxkZB3lSVroz1EZ3EQJhCpi9177C58h42ESeLO_e0Mj2tOpkV9D9LkStCbcgbjTPRXambPRP f9hJpOiRQoBKWvyOL7YLI93jwKbKuP_FCq1qweiJ7FK-l_MnTCtGhyw%3D%3D%22%5D%5D; XSRF- TOKEN=eyJpdiI6IjBsQmxya3R2cFpXRGRrcldCL1NhdHc9PSIsInZhbHVlIjoiL3hURFY0Z1dHdE9sdnRBT3ZnK3RPQm1KWDgxMV hPSWlqMkVhbjRHMGN0ajRiVU1uSitnZy9rUWxYaHZWbC9lK0hFUW1hNDA0c0pzbEpUSUJtQ2M3TnloTDlHYnVHMVplWmtOSjdkK0 tMVlBnenBGQyt3aUFYU2tUeGFJY1k4c2UiLCJtYWMiOiJiMjk3ZjNkMTBhMzU2OTMyOWNmMWY0MmZmNjllOGNlYzAyNzlmYjk0N2 E1OWJiNzMzNmEwZjdjZjNjODFkNmMxIn0%3D;  laravel_session=eyJpdiI6ImgyRExlZG1pbWhYNVhyZHRCV2hKSGc9PSIsInZhbHVlIjoiOFpMUkZRaEhyUTM5T1NQUEtCT2Nk K21ZeVl4K1lnOFF6NklPUFMyUXp0c2Z2cWZCSUlLbW9Kci9PblRlcHhmUi9FYnNIVFF1VnpQbERtQkFRdU00SXYvWEcvNGhiTmFP Ylg5L1BWUFAyNTNNdktJMXVSZFRyTnRrSmhvdS9Ja3YiLCJtYWMiOiI4Y2I0YjI3ODgwNTYyNGVmZjJkNWQyOTgzZGU5N2YzMWMw MjNkZmNlMGMzMGI1NTkwNmEyZTVjNjJiYmY1Mzk3In0%3D;  _ga_0JTJC26W3L=GS1.1.1701859641.8.1.1701860123.0.0.0',
    'origin': 'https://instanavigation.com',
    'referer': 'https://instanavigation.com/user-profile/hale.khoob111',
    'sec-ch-ua': '"Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"macOS"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-origin',
    'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like  Gecko) Chrome/119.0.0.0 Safari/537.36',
    'x-xsrf-token':   'eyJpdiI6IjBsQmxya3R2cFpXRGRrcldCL1NhdHc9PSIsInZhbHVlIjoiL3hURFY0Z1dHdE9sdnRBT3ZnK3RPQm1KWDgxMVhPSWl  qMkVhbjRHMGN0ajRiVU1uSitnZy9rUWxYaHZWbC9lK0hFUW1hNDA0c0pzbEpUSUJtQ2M3TnloTDlHYnVHMVplWmtOSjdkK0tMVlB  nenBGQyt3aUFYU2tUeGFJY1k4c2UiLCJtYWMiOiJiMjk3ZjNkMTBhMzU2OTMyOWNmMWY0MmZmNjllOGNlYzAyNzlmYjk0N2E1OWJ  iNzMzNmEwZjdjZjNjODFkNmMxIn0=',
}

json_data = {
    'userName': 'hale.khoob111',
}

response = requests.post('https://instanavigation.com/get-user-info', cookies=cookies,                      headers=headers, json=json_data)

I have tried this code and it doesn't work

0

There are 0 answers