forked from dilame/instagram-private-api
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsearch.service.ts
29 lines (27 loc) · 973 Bytes
/
search.service.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Repository } from '../core/repository';
export class SearchService extends Repository {
public async blended(query: string) {
const result = await this.client.fbsearch.topsearchFlat(query);
return result.list;
}
public async blendedItems(query: string) {
const list = await this.blended(query);
return list.map(item => item.user || item.hashtag || item.place);
}
public async users(query: string) {
const result = await this.client.user.search(query);
return result.users;
}
public async tags(query: string) {
const result = await this.client.tag.search(query);
return result.results;
}
public async places(query: string) {
const result = await this.client.fbsearch.places(query);
return result.items;
}
public async location(latitude: number, longitude: number, query?: string) {
const result = await this.client.locationSearch.index(latitude, longitude, query);
return result.venues;
}
}