-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Endpoint class, replace unnecessary links, add InstagramNotFoundE…
…xception
- Loading branch information
Showing
6 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package me.postaddict.instagram; | ||
|
||
public class Endpoint { | ||
public static final String BASE_URL = "https://www.instagram.com"; | ||
public static final String ACCOUNT_PAGE = "https://www.instagram.com/{{username}}"; | ||
public static final String MEDIA_LINK = "https://www.instagram.com/p/{{code}}"; | ||
public static final String ACCOUNT_MEDIAS = "https://www.instagram.com/{{username}}/media?max_id={{maxId}}"; | ||
public static final String ACCOUNT_JSON_INFO = "https://www.instagram.com/{{username}}/?__a=1"; | ||
public static final String MEDIA_JSON_INFO = "https://www.instagram.com/p/{{code}}/?__a=1"; | ||
public static final String MEDIA_JSON_BY_LOCATION_ID = "https://www.instagram.com/explore/locations/{{facebookLocationId}}/?__a=1"; | ||
public static final String MEDIA_JSON_BY_TAG = "https://www.instagram.com/explore/tags/{{tag}}/?__a=1&max_id={{maxId}}"; | ||
public static final String GENERAL_SEARCH = "https://www.instagram.com/web/search/topsearch/?query={{query}}"; | ||
public static final String ACCOUNT_JSON_INFO_BY_ID = "https://www.instagram.com/query/?q=ig_user({{userId}}){id,username,external_url,full_name,profile_pic_url,biography,followed_by{count},follows{count},media{count},is_private,is_verified}"; | ||
public static final String LAST_COMMENTS_BY_CODE = "https://www.instagram.com/query/?q=ig_shortcode({{code}}){comments.last({{count}}){count,nodes{id,created_at,text,user{id,profile_pic_url,username,follows{count},followed_by{count},biography,full_name,media{count},is_private,external_url,is_verified}},page_info}}"; | ||
public static final String COMMENTS_BEFORE_COMMENT_ID_BY_CODE = "https://www.instagram.com/query/?q=ig_shortcode({{code}}){comments.before({{commentId}},{{count}}){count,nodes{id,created_at,text,user{id,profile_pic_url,username,follows{count},followed_by{count},biography,full_name,media{count},is_private,external_url,is_verified}},page_info}}"; | ||
|
||
public static String getAccountPageLink(String username) { | ||
return ACCOUNT_PAGE.replace("{{username}}", username); | ||
} | ||
|
||
public static String getAccountJsonInfoLinkByUsername(String username) { | ||
return ACCOUNT_JSON_INFO.replace("{{username}}", username); | ||
} | ||
|
||
public static String getAccountJsonInfoLinkByAccountId(String userId) { | ||
return ACCOUNT_JSON_INFO_BY_ID.replace("{{userId}}", userId); | ||
} | ||
|
||
public static String getAccountMediasJsonLink(String username, String maxId) { | ||
if (maxId == null) { | ||
maxId = ""; | ||
} | ||
return ACCOUNT_MEDIAS.replace("{{username}}", username).replace("{{maxId}}", maxId); | ||
} | ||
|
||
public static String getMediaPageLinkByCode(String code) { | ||
return MEDIA_LINK.replace("{{code}}", code); | ||
} | ||
|
||
public static String getMediaJsonLinkByShortcode(String shortcode) { | ||
return MEDIA_JSON_INFO.replace("{{code}}", shortcode); | ||
} | ||
|
||
public static String getMediasJsonByLocationIdLink(String facebookLocationId) { | ||
return MEDIA_JSON_BY_LOCATION_ID.replace("{{facebookLocationId}}", facebookLocationId); | ||
} | ||
|
||
public static String getMediasJsonByTagLink(String tag, String maxId) { | ||
if (maxId == null) { | ||
maxId = ""; | ||
} | ||
return MEDIA_JSON_BY_TAG.replace("{{tag}}", tag).replace("{{maxId}}", maxId); | ||
} | ||
|
||
public static String getGeneralSearchJsonLink(String query) { | ||
return GENERAL_SEARCH.replace("{{query}}", query); | ||
} | ||
|
||
public static String getLastCommentsByCodeLink(String code, int count) { | ||
return LAST_COMMENTS_BY_CODE | ||
.replace("{{code}}", code) | ||
.replace("{{count}}", "" + count); | ||
} | ||
|
||
public static String getCommentsBeforeCommentIdByCode(String code, int count, String commentId) { | ||
return COMMENTS_BEFORE_COMMENT_ID_BY_CODE | ||
.replace("{{code}}", code) | ||
.replace("{{count}}", "" + count) | ||
.replace("{{commentId}}", commentId); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...taddict/instagram/InstagramException.java → ...stagram/exception/InstagramException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/me/postaddict/instagram/exception/InstagramNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package me.postaddict.instagram.exception; | ||
|
||
public class InstagramNotFoundException extends InstagramException { | ||
|
||
public InstagramNotFoundException() { | ||
} | ||
|
||
public InstagramNotFoundException(String message) { | ||
super(message); | ||
} | ||
} |