Instagram-private-api: How to get Media from Hashtag ?

Created on 14 Dec 2017  路  3Comments  路  Source: dilame/instagram-private-api

Hey guys,

really love what you have done with this lib! 馃

Makes my life after the "official v2 API"-Horror a lot easier.
i digged into some stuff for a couple of hourse now and mostly everything worked out well,
but ... i can not find a solution for this challenge.

How do i get Media Items after searching for a Hashtag?
Client.Hashtag.search(Session, "#sometag").then(data=> { console.log("Data:", data[0].id); })
i tried to set this id in
Client.Media.getById(Session, **id**).then(data=> { console.log("media data:", data); })
but as i thought without any success because it is no id of a video, more of a searchresult, right?

anyways ...
Where do i put this number to get all of the 10303 mediaItems listed on the Hashtag.seach-Result
{ name: 'sometag', id: '17843202973034003', mediaCount: 10303 },

Can not find out how!

Most helpful comment

I experienced the same problem. Like you said the ID you provide in Media.getById should be a media ID, not a hashtag ID. I used Feeds to do what you're trying to do. It uses the TaggedMedia feed type. What I did wrong was that I was proving the hashtag id instead of the hashtag itself, took me a while to figure out haha

This is my code

async function main() {
    let session = await Client.Session.create("---------");
    console.log("Logged on");

    let feed = new Client.Feed.TaggedMedia(session, "putyourhashtaghere");
    let results = await feed.get();
    console.log(results); // array of Media instances
}

main();

All 3 comments

I experienced the same problem. Like you said the ID you provide in Media.getById should be a media ID, not a hashtag ID. I used Feeds to do what you're trying to do. It uses the TaggedMedia feed type. What I did wrong was that I was proving the hashtag id instead of the hashtag itself, took me a while to figure out haha

This is my code

async function main() {
    let session = await Client.Session.create("---------");
    console.log("Logged on");

    let feed = new Client.Feed.TaggedMedia(session, "putyourhashtaghere");
    let results = await feed.get();
    console.log(results); // array of Media instances
}

main();

i guess this is what i wanted!

THX @timgfx

@timgfx problem of this its give not too much media maximum is 70 you know any idea how make get more

Was this page helpful?
0 / 5 - 0 ratings