Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking new posts with this library #269

Open
RasmonT opened this issue Sep 13, 2021 · 0 comments
Open

Tracking new posts with this library #269

RasmonT opened this issue Sep 13, 2021 · 0 comments

Comments

@RasmonT
Copy link

RasmonT commented Sep 13, 2021

Hello there!

I'm trying to make instagram bot that will track new posts from the public instagram account, then i want to send the link of the post the discord... So i will need to get update from instagram account once it posts new post.. then i need get shortcode of new IG post from it, so I can excute discord code.

So far i made this... i'm able to get data from certain instagram, but how i can search for only new post made? Do some code with cron maybe? Any help will be much appreciate.

I will receive arrays from the last posts and it also contains the shortcode.

const dotenv = require('dotenv');
dotenv.config({ path: './process.env' });
const username = process.env.IGUSERNAME
const password = process.env.IGPASSWORD
 
const IGclient = new Instagram({ username, password })
 
IGclient
    .login()
    .then((data1) => {
      console.log('Data1: ', data1)
      IGclient
        .getProfile()
        .then(data => {
          console.log("Data: ", data);
          (async () => {
            await IGclient.login()
            await IGclient.getUserByUsername({ username: "worldstar" })
          .then(res => console.log('My media:',res.edge_owner_to_timeline_media.edges)) // it returns an array of your user's medias.
        })()
    })
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant