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

Get Reels Tab Vidoes #1733

Open
zakrian07 opened this issue Nov 15, 2023 · 5 comments
Open

Get Reels Tab Vidoes #1733

zakrian07 opened this issue Nov 15, 2023 · 5 comments
Labels
question unconfirmed This issue hasn't been read/confirmed/accepted by an admin

Comments

@zakrian07
Copy link

Hello I want fetch the UserReels of a user
https://www.instagram.com/luliziv/reels/
image
specific for this tab i dont want loop from user posts if there is 5 k posts and only 5 videos it will loop with all data
my goal is just get reels
async function getReelsByUsername(ig: IgApiClient, username: string) {
const targetUser = await ig.user.searchExact(username);
console.log("targetuser",targetUser)
const reelsFeed = ig.feed.reelsMedia({ userIds: [targetUser.pk] });
const allReels = [];
console.log("reelsFeed",reelsFeed)
let reels = await reelsFeed.items();
allReels.push(...reels);
console.log(Fetched ${reels.length} reels);

while (reelsFeed.isMoreAvailable()) {
console.log('More reels are available, fetching...');
reels = await reelsFeed.items();
allReels.push(...reels);
console.log(Fetched ${reels.length} more reels);
}

return allReels.map(reel => ({
id: reel.id,
videoUrl: reel.video_versions ? reel.video_versions[0].url : null,
caption: reel.caption ? reel.caption.text : '',
}));
} this is not giving me expected results here is out put npx ts-node ./examples/session.example.ts
Session file path: /home/singhera/projects/instagram/instagram-private-api/examples/session.json
Session file exists.
Session data loaded successfully.
Login works.
targetuser [Object: null prototype] {
fbid_v2: '17841401558740719',
pk: 46067958,
pk_id: '46067958',
strong_id__: '46067958',
full_name: 'Ludovica Guspini | LuliZiv ♥ Safe Zone',
is_private: false,
third_party_downloads_enabled: 1,
has_anonymous_profile_picture: false,
username: 'luliziv',
is_verified: true,
profile_pic_id: '3200604805365274706_46067958',
profile_pic_url: 'https://instagram.fkhi4-4.fna.fbcdn.net/v/t51.2885-19/382903399_1613943749014007_4468674898876614633_n.jpg?stp=dst-jpg_e0_s150x150&_nc_ad=z-m&_nc_ht=instagram.fkhi4-4.fna.fbcdn.net&_nc_cat=111&_nc_ohc=0ZmfLxaQ7HsAX8Enphx&edm=AM7KJZYBAAAA&ccb=7-5&oh=00_AfBylTgNHmApj2Rx1GZN3OViofARs5F8bVI_3WfupZEXJw&oe=6559E96F&_nc_sid=8ec269',
has_opt_eligible_shop: false,
account_badges: [],
friendship_status: [Object: null prototype] {
following: false,
is_private: false,
incoming_request: false,
outgoing_request: false,
is_bestie: false,
is_restricted: false,
is_feed_favorite: false
},
latest_reel_media: 1700052540,
is_verified_search_boosted: false,
should_show_category: false
}
reelsFeed ReelsMediaFeed {
attemptOptions: {
delay: 60000,
factor: 1.5,
maxAttempts: 10,
minDelay: 60000,
maxDelay: 300000,
jitter: true
},
rankToken: undefined,
source: 'feed_timeline',
userIds: [ 46067958 ],
moreAvailable: undefined
}
Saving session to file...
Session saved successfully.
Fetched 3 reels
[
{
id: '3235958857074720616_46067958',
videoUrl: 'https://instagram.fkhi4-2.fna.fbcdn.net/o1/v/t16/f1/m78/5C49C26C9D3A5EE7CB16885DD96E3786_video_dashinit.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLnN0b3J5LmMyLjcyMC5iYXNlbGluZSJ9&_nc_ht=instagram.fkhi4-2.fna.fbcdn.net&_nc_cat=102&vs=1497430581045694_1615315621&_nc_vs=HBksFQIYUWlnX3hwdl9wbGFjZW1lbnRfcGVybWFuZW50X3YyLzVDNDlDMjZDOUQzQTVFRTdDQjE2ODg1REQ5NkUzNzg2X3ZpZGVvX2Rhc2hpbml0Lm1wNBUAAsgBABUCGDpwYXNzdGhyb3VnaF9ldmVyc3RvcmUvR0h3TDVSZEc1QWNmV3RZQUFFZkxIVzBqOVI0ZGJwa3dBQUFGFQICyAEAKAAYABsBiAd1c2Vfb2lsATEVAAAmlr%2Fgnqz9nUEVAigCQzMsF0AZMzMzMzMzGBJkYXNoX2Jhc2VsaW5lXzFfdjERAHXoBwA%3D&_nc_rid=bebcbeac8a&ccb=9-4&oh=00_AfA5JlZuG_1tTEHzJYeA1vF15QaT-xb7uhxLSt1KbfWNtA&oe=65561CEC&_nc_sid=982cc7',
caption: ''
},
{ id: '3236080833239788401_46067958', videoUrl: null, caption: '' },
{ id: '3236597764355209921_46067958', videoUrl: null, caption: '' }
]
Saving session to file...
Session saved successfully. any help will be great this is breaking data coming

@zakrian07 zakrian07 added question unconfirmed This issue hasn't been read/confirmed/accepted by an admin labels Nov 15, 2023
@NickCis
Copy link

NickCis commented Nov 29, 2023

It's implemented in this PR . This issue is a duplication of #1308 .

@zakrian07
Copy link
Author

@NickCis can you help me how can i do this i could not find a direction or doc for this

@NickCis
Copy link

NickCis commented Dec 1, 2023

You'll have to fork the PR or use the published versión I've forked (@nickcis/instagram-private-api).

Then you should edit your example and useconst feed = ig.feed.clips(targetUser.pk); instead of ig.feed.reelsMedia({ userIds: [targetUser.pk] });. You should avoid the seen call.

@zakrian07
Copy link
Author

Let me give a try and share code example

@zakrian07
Copy link
Author

zakrian07 commented Dec 2, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question unconfirmed This issue hasn't been read/confirmed/accepted by an admin
Projects
None yet
Development

No branches or pull requests

2 participants