@@ -176,14 +176,11 @@ export function createApi(
176176 */
177177export class Hashtag < T > extends Instagram < T > {
178178 constructor ( id : string , options : IOptions = { } ) {
179- const endpoint = "https://instagram.com/explore/tags/[id]" ;
180- const pageQuery = "data.hashtag.edge_hashtag_to_media.page_info" ;
181- const edgeQuery = "data.hashtag.edge_hashtag_to_media.edges" ;
182179 super (
183- endpoint ,
180+ "https://instagram.com/explore/tags/[id]" ,
184181 id ,
185- pageQuery ,
186- edgeQuery ,
182+ "data.hashtag.edge_hashtag_to_media.page_info" ,
183+ "data.hashtag.edge_hashtag_to_media.edges" ,
187184 options ,
188185 getPageValidator ( options ) ,
189186 ) ;
@@ -194,15 +191,34 @@ export class Hashtag<T> extends Instagram<T> {
194191 * An Instagram user API wrapper
195192 */
196193export class User < T > extends Instagram < T > {
194+ defaultPageFunctions = [
195+ ( ) => {
196+ let morePostsIntervalCounter = 0 ;
197+ const morePostsInterval = setInterval ( ( ) => {
198+ const searchDiv = Array . from (
199+ document . getElementsByTagName ( "div" ) ,
200+ ) . filter ( ( d ) =>
201+ d . innerHTML . startsWith ( "Show More Posts from" ) ,
202+ ) [ 0 ] ;
203+
204+ morePostsIntervalCounter ++ ;
205+
206+ if ( searchDiv !== undefined ) {
207+ searchDiv . parentElement . parentElement . click ( ) ;
208+ clearInterval ( morePostsInterval ) ;
209+ } else if ( morePostsIntervalCounter > 10 ) {
210+ clearInterval ( morePostsInterval ) ;
211+ }
212+ } , 1000 ) ;
213+ } ,
214+ ] ;
215+
197216 constructor ( id : string , options : IOptions = { } ) {
198- const endpoint = "https://instagram.com/[id]" ;
199- const pageQuery = "data.user.edge_owner_to_timeline_media.page_info" ;
200- const edgeQuery = "data.user.edge_owner_to_timeline_media.edges" ;
201217 super (
202- endpoint ,
218+ "https://instagram.com/[id]" ,
203219 id ,
204- pageQuery ,
205- edgeQuery ,
220+ "data.user.edge_owner_to_timeline_media.page_info" ,
221+ "data.user.edge_owner_to_timeline_media.edges" ,
206222 options ,
207223 getPageValidator ( options ) ,
208224 ) ;
0 commit comments