azimgd / instagram-private-api

25 stars 6 forks source link

Fresh clone not working #2

Open 0x62 opened 7 years ago

0x62 commented 7 years ago

As per example:

Benedict at mbp in ~/Downloads/ig-test
$ git clone git@github.com:azimgd/instagram-private-api.git .
Cloning into '.'...
remote: Counting objects: 179, done.
remote: Total 179 (delta 0), reused 0 (delta 0), pack-reused 179
Receiving objects: 100% (179/179), 20.99 KiB | 0 bytes/s, done.
Resolving deltas: 100% (67/67), done.

Benedict at mbp in ~/Downloads/ig-test on master
$ npm install
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.

> instagram-private@0.0.1 prepublish /Users/Benedict/Downloads/ig-test
> npm run compile

> instagram-private@0.0.1 compile /Users/Benedict/Downloads/ig-test
> babel --presets es2015,stage-0 -d lib/ src/

sh: babel: command not found

Benedict at mbp in ~/Downloads/ig-test on master
$ node -v
v6.9.0

If I install babel-cli before running:

Benedict at mbp in ~/Downloads/ig-test on master
$ npm install

> instagram-private@0.0.1 prepublish /Users/Benedict/Downloads/ig-test
> npm run compile

> instagram-private@0.0.1 compile /Users/Benedict/Downloads/ig-test
> babel --presets es2015,stage-0 -d lib/ src/

src/init.js -> lib/init.js
src/services/http.js -> lib/services/http.js
src/sources/defaultHeaders.js -> lib/sources/defaultHeaders.js
src/sources/getFeedByHashtag.js -> lib/sources/getFeedByHashtag.js
src/sources/getSelfFeed.js -> lib/sources/getSelfFeed.js
src/utils/index.js -> lib/utils/index.js

Benedict at mbp in ~/Downloads/ig-test on master
$ node examples/example.js
/Users/Benedict/Downloads/ig-test/examples/example.js:1
(function (exports, require, module, __filename, __dirname) { import bot from '../index';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    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
0x62 commented 7 years ago

As a temporary fix, below is a transpiled version of example.js, which works out of the box:

'use strict';
var _index = require('../index');
var _index2 = _interopRequireDefault(_index);
var _dotenv = require('dotenv');
var _dotenv2 = _interopRequireDefault(_dotenv);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

_dotenv2.default.config();

var username = process.env.username;
var password = process.env.password;

// bot.auth(username, password)
// .then((headers) => bot.setLike(headers, '1157751993106715465_5932067'));
//
// bot.auth(username, password)
// .then((headers) => bot.setComment(headers, '1156408808103072490_518286907', 'somehow this comment must be ignored, i guess!'));
//
// bot.auth(username, password)
// .then((headers) => bot.unsetFollow(headers, '29738951'));
//
// bot.auth(username, password)
// .then((headers) => bot.setFollow(headers, '29738951'));
//

_index2.default.auth(username, password).then(function (headers) {
  return _index2.default.getFeedByHashtag(headers, 'cats');
}).then(function (res) {
  return console.log(res);
});