Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { RestrictActionRepository } from '../repositories/restrict-action.reposi
import { AddressBookRepository } from '../repositories/address-book.repository';
import { StatusRepository } from '../repositories/status.repository';
import { IgtvRepository } from '../repositories/igtv.repository';
import { ArchiveRepository } from '../repositories/archive.repository';

export class IgApiClient {
public state = new State();
Expand Down Expand Up @@ -76,6 +77,7 @@ export class IgApiClient {
public addressBook = new AddressBookRepository(this);
public status = new StatusRepository(this);
public igtv = new IgtvRepository(this);
public archive = new ArchiveRepository(this);
/* Services */
public publish = new PublishService(this);
public search = new SearchService(this);
Expand Down
16 changes: 16 additions & 0 deletions src/repositories/archive.repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Repository } from '../core/repository';
import {ArchiveRepositoryLivesResponseRootObject} from '../responses';

export class ArchiveRepository extends Repository {
public async lives(): Promise<ArchiveRepositoryLivesResponseRootObject> {
const { body } = await this.client.request.send<ArchiveRepositoryLivesResponseRootObject>({
url: '/api/v1/archive/live/lives_archived/',
method: 'GET',
headers: {
'User-Agent': `Instagram 172.0.0.21.123 Android (${this.client.state.deviceString}; ${this.client.state.language}; 269790810)`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why hardcode User-Agent?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a 404 with the default User-Agent. I think they are using the app version present in the user-agent to enable/disable some endpoints.

}
});

return body;
}
}
58 changes: 58 additions & 0 deletions src/responses/archive.repository.lives.response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
export interface ArchiveRepositoryLivesResponseRootObject {
items: ArchiveRepositoryLivesResponseResultsItem[];
count: number;
status: string;
}
export interface ArchiveRepositoryLivesResponseResultsItem {
pk: string;
user: ArchiveRepositoryLivesResponseUsersItem;
broadcast: ArchiveRepositoryLivesResponseBroadcastsItem;
last_seen_broadcast_ts: number;
can_reply: boolean;
can_reshare: boolean;
can_share_to_igtv: boolean;
}

export class ArchiveRepositoryLivesResponseUsersItem {
pk: number;
username: string;
full_name: string;
is_private: boolean;
profile_pic_url: string;
is_verified: boolean;
}

export class ArchiveRepositoryLivesResponseBroadcastsItem {
id: number;
broadcast_status: string;
broadcast_owner: ArchiveRepositoryLivesResponseBroadcastOwnersItem;
published_time: number;
video_duration: number;
media_id: string;
broadcast_message: string;
internal_only: boolean;
cover_frame_url: string;
progressive_playback_url: string;
}

export class ArchiveRepositoryLivesResponseBroadcastOwnersItem {
pk: number;
username: string;
full_name: string;
is_private: boolean;
profile_pic_url: string;
friendship_status: ArchiveRepositoryLivesResponseBroadcastOwnerFriendshipStatusesItem;
is_verified: boolean;
}

export class ArchiveRepositoryLivesResponseBroadcastOwnerFriendshipStatusesItem {
following: boolean;
followed_by: boolean;
blocking: boolean;
muting: boolean;
is_private: boolean;
incoming_request: boolean;
outgoing_request: boolean;
is_bestie: boolean;
is_restricted: boolean;
}
1 change: 1 addition & 0 deletions src/responses/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ export * from './igtv.channel.feed.response';
export * from './igtv.search.response';
export * from './liked.feed.response';
export * from './topical-explore.feed.response';
export * from './archive.repository.lives.response';