Instagram-private-api: Error in demo project

Created on 10 Dec 2016  Â·  3Comments  Â·  Source: dilame/instagram-private-api

I try use demo code, but its not work.

var Client = require('instagram-private-api').V1;
var device = new Client.Device('someuser');
var storage = new Client.CookieFileStorage('cookies/someuser.json');

// And go for login
Client.Session.create(device, storage, 'Login', 'Pass')
    .then(function(session) {
        // Now you have a session, we can follow / unfollow, anything...
        // And we want to follow Instagram official profile
        return [session, Client.Account.searchForUser(session, 'instagram')]
    })
`

"C:\Program Files (x86)\JetBrains\WebStorm 2016.3.1\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" C:\Users\Раджаб\WebstormProjects\untitled\2.js
fs.js:1089
return binding.unlink(pathModule._makeLong(path));
^

Error: ENOENT: no such file or directory, unlink 'C:\Users\Раджаб\WebstormProjects\untitled\cookies\someuser.json'
at Error (native)
at Object.fs.unlinkSync (fs.js:1089:18)
at Object.Helpers.ensureExistenceOfJSONFilePath (C:\Users\Раджаб\node_modules\instagram-private-api\helpers.js:52:12)
at new CookieFileStorage (C:\Users\Раджаб\node_modules\instagram-private-api\client\v1\cookie-file-storage.js:12:13)
at Object. (C:\Users\Раджаб\WebstormProjects\untitled\2.js:3:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

Process finished with exit code 1
`

Most helpful comment

I don't mean to be rude in any way but if you can't point the storage variable to the json file you created you might not be able to work with the rest of the library. But here is how you would fix your current issue.

  1. Make a folder called cookies in your project file. (The file with the current js file you are working in)
  2. Make a file in the cookies folder you just created called "someuser.json"
  3. Run the demo file that you have all of your code in and it should work

All 3 comments

You need to make a json file and point the storage variable to the file you made.

i bad know nodejs. Can you upload demo proj?

I don't mean to be rude in any way but if you can't point the storage variable to the json file you created you might not be able to work with the rest of the library. But here is how you would fix your current issue.

  1. Make a folder called cookies in your project file. (The file with the current js file you are working in)
  2. Make a file in the cookies folder you just created called "someuser.json"
  3. Run the demo file that you have all of your code in and it should work
Was this page helpful?
0 / 5 - 0 ratings

Related issues

codingzombies picture codingzombies  Â·  19Comments

haliliceylan picture haliliceylan  Â·  29Comments

iMrDJAi picture iMrDJAi  Â·  34Comments

350d picture 350d  Â·  53Comments

delmotte picture delmotte  Â·  61Comments