Coder Social home page Coder Social logo

Comments (7)

webistomin avatar webistomin commented on July 30, 2024

Just Tried the post id example and got this error:
(node:13776) UnhandledPromiseRejectionWarning: ReferenceError: XMLHttpRequest is not defined

the first thing I did was to install hmlhttprequest manually with npm, but no changes....

Are you using this library in node.js?

Try

const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;

// For versions of node earlier than 12.x, use this globalThis polyfill:
(function() {
  if (typeof globalThis === 'object') return;
  Object.defineProperty(Object.prototype, '__magic__', {
    get: function() {
      return this;
    },
    configurable: true
  });
  __magic__.globalThis = __magic__;
  delete Object.prototype.__magic__;
}());

if (!globalThis.XMLHttpRequest) {
  globalThis.XMLHttpRequest = XMLHttpRequest;
}

from nanogram.js.

EhsanFox avatar EhsanFox commented on July 30, 2024

hey, sorry for the late reply,

yes I do use it with using node.js

and I just woke up, add this code to the file, and launched the code for the 1st time, and got this error:
Error: [nanogram.js] It looks like your network has been temporary banned because of too many requests.

from nanogram.js.

EhsanFox avatar EhsanFox commented on July 30, 2024

it was the 1st time and it's a little bit confusing!

from nanogram.js.

webistomin avatar webistomin commented on July 30, 2024

it was the 1st time and it's a little bit confusing!

Try this:

const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
const getMediaByUsername = require('nanogram.js').getMediaByUsername;

(function () {
  if (typeof globalThis === 'object') return;
  Object.defineProperty(Object.prototype, '__magic__', {
    get: function () {
      return this;
    },
    configurable: true,
  });
  __magic__.globalThis = __magic__;
  delete Object.prototype.__magic__;
})();

if (!globalThis.XMLHttpRequest) {
  globalThis.XMLHttpRequest = XMLHttpRequest;
}

getMediaByUsername('instagram').then((media) => {
  console.log(media);
});

Does it work for you?

from nanogram.js.

EhsanFox avatar EhsanFox commented on July 30, 2024

it came with the same Error: [nanogram.js] It looks like your network has been temporary banned because of too many requests. error!

from nanogram.js.

webistomin avatar webistomin commented on July 30, 2024

it came with the same Error: [nanogram.js] It looks like your network has been temporary banned because of too many requests. error!

Seems like Instagram detected bot activity on your end. It works fine for me.

from nanogram.js.

EhsanFox avatar EhsanFox commented on July 30, 2024

However, im gonna try with vpn or even on vps later, thank u!

from nanogram.js.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.