-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated samples and credentials provider
- Loading branch information
1 parent
8ae4b7e
commit bf30e11
Showing
29 changed files
with
231 additions
and
211 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,54 @@ | ||
plugins { | ||
kotlin("jvm") version "1.4.30" | ||
id("org.jetbrains.dokka") version "1.4.20" | ||
} | ||
|
||
group = "com.hadiyarajesh" | ||
version = "1.0.0" | ||
java.sourceCompatibility = JavaVersion.VERSION_11 | ||
|
||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
maven(url = "https://jitpack.io") | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java.srcDir("src/main/kotlin") | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3") | ||
implementation("com.github.jkcclemens:khttp:-SNAPSHOT") | ||
implementation("com.nfeld.jsonpathlite:json-path-lite:1.1.0") | ||
implementation("org.json:json:20180813") | ||
} | ||
|
||
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach { | ||
dokkaSourceSets { | ||
named("main") { | ||
moduleName.set("instagram-api") | ||
includeNonPublic.set(false) | ||
|
||
perPackageOption { | ||
matchingRegex.set("api($|\\.).*") // will match all api packages and sub-packages | ||
suppress.set(true) | ||
} | ||
perPackageOption { | ||
matchingRegex.set("util($|\\.).*") // will match all util packages and sub-packages | ||
suppress.set(true) | ||
} | ||
perPackageOption { | ||
matchingRegex.set("samples($|\\.).*") // will match all samples packages and sub-packages | ||
suppress.set(true) | ||
} | ||
perPackageOption { | ||
matchingRegex.set("com.nfeld.jsonpathlite($|\\.).*") // will match all com.nfeld.jsonpathlite packages and sub-packages | ||
suppress.set(true) | ||
} | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,9 @@ | ||
rootProject.name = "InstagramAPI" | ||
|
||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
jcenter() | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -1,45 +1,47 @@ | ||
import bot.InstagramBot | ||
import kotlinx.coroutines.* | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.InternalCoroutinesApi | ||
import kotlinx.coroutines.flow.collect | ||
import kotlinx.coroutines.runBlocking | ||
|
||
@InternalCoroutinesApi | ||
@ExperimentalCoroutinesApi | ||
fun main() { | ||
fun main() = runBlocking { | ||
|
||
val username = "your_instagram_username" | ||
val password = "your_instagram_password" | ||
val username = Credentials.USERNAME | ||
val password = Credentials.PASSWORD | ||
|
||
val bot = InstagramBot() | ||
bot.prepare(username) | ||
bot.login(username, password) | ||
|
||
/** | ||
* Minimum and maximum time to sleep before performing next action. | ||
* Minimum and maximum time (in seconds) to wait before performing next action. | ||
* Actual time will be randomly generated each time between min and max time | ||
*/ | ||
|
||
bot.minSleepTime = 100 | ||
bot.maxSleepTime = 200 | ||
bot.minSleepTime = 150 | ||
bot.maxSleepTime = 300 | ||
|
||
// Provide your comment list here | ||
val commentsList = listOf("Sample comment 1", "Sample comment 2") | ||
val userList = listOf("username1", "username2") | ||
// Provide your username list here | ||
val userList = listOf("user_name_1", "user_name_2") | ||
|
||
runBlocking { | ||
// Get your own followers | ||
bot.getSelfFollowing(Int.MAX_VALUE).collect { println(it) } | ||
// Get 100 followers of given username | ||
bot.getUserFollowers("user_name", 100, isUsername = true).collect { println(it) } | ||
// Like 5 medias from explore page | ||
bot.likeMediasByExplorePage(5).collect { println(it) } | ||
// Comment 5 medias having given hashtag and given comment list | ||
bot.commentMediasByHashTag("hashtag_name", commentsList, 5).collect { println(it) } | ||
// Follow given list of users | ||
bot.followUsers(userList).collect { println(it) } | ||
// Approve all pending follow requests | ||
bot.approveAllPendingFollowRequests().collect { println(it) } | ||
// Watch stories of 200 users based on given location | ||
bot.watchLocationUsersStories("location_name", 200).collect { println(it) } | ||
// Download latest 5 medias of given username along with caption | ||
bot.downloadUserMedias("user_name", 5, true).collect { println(it) } | ||
} | ||
// Get your own followers | ||
bot.getSelfFollowing(Int.MAX_VALUE).collect { println(it) } | ||
// Get 100 followers of given username | ||
bot.getUserFollowers("enter_user_name_here", 100, isUsername = true).collect { println(it) } | ||
// Like 5 medias from explore page | ||
bot.likeMediasByExplorePage(5).collect { println(it) } | ||
// Comment 5 medias having given hashtag and given comment list | ||
bot.commentMediasByHashTag("enter_hashtag_name_here", commentsList, 5).collect { println(it) } | ||
// Follow given list of users | ||
bot.followUsers(userList).collect { println(it) } | ||
// Approve all pending follow requests | ||
bot.approveAllPendingFollowRequests().collect { println(it) } | ||
// Watch stories of 200 users based on given location | ||
bot.watchLocationUsersStories("enter_location_name_here", 200).collect { println(it) } | ||
// Download latest 5 medias of given user along with caption | ||
bot.downloadUserMedias("enter_user_name_here", 5, true).collect { println(it) } | ||
} |
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,4 @@ | ||
object Credentials { | ||
const val USERNAME = "enter_your_instagram_username_here" | ||
const val PASSWORD = "enter_your_instagram_password_here" | ||
} |
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
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
Oops, something went wrong.