hadiyarajesh / insta-bot

Instagram automation library to perform likes, comments, follow, story viewing and much more.
MIT License
37 stars 6 forks source link

its not working #2

Closed mohsen2986 closed 3 years ago

mohsen2986 commented 3 years ago

first issue that i archived is can not convert long to string in get_id function ! and when i fix it still have no response from API!!! it actually still work?

hadiyarajesh commented 3 years ago

Can you provide some logs and your modification? And how you're calling this function?

mohsen2986 commented 3 years ago

ofcourse ... i clone hole repository for contribute , i think this is really great project in your sample directory sampels/follow/followUserFollowers i just replace the user value with some id like this val user = "my_id" but i get this

Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String at bot.InstagramBot.getUserIdByName(InstagramBot.kt:425) at bot.InstagramBot.convertToUserId(InstagramBot.kt:446) at bot.InstagramBot.getUserFollowers(InstagramBot.kt:556) at bot.InstagramBot.getUserFollowers$default(InstagramBot.kt:551) at bot.InstagramBot.followUserFollowers(InstagramBot.kt:1621) at bot.InstagramBot.followUserFollowers$default(InstagramBot.kt:1619) at samples.follow.FollowUsersFollowersKt$main$1.invokeSuspend(FollowUsersFollowers.kt:22) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:271) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:79) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) at samples.follow.FollowUsersFollowersKt.main(FollowUsersFollowers.kt:10) at samples.follow.FollowUsersFollowersKt.main(FollowUsersFollowers.kt)

hadiyarajesh commented 3 years ago

You need to use your username in that function, not (numeric) user id. Try with username and let me know the result.

mohsen2986 commented 3 years ago

i just do this , here is my code `@ExperimentalCoroutinesApi fun main() = runBlocking {

val username = Credentials.USERNAME
val password = Credentials.PASSWORD

val bot = InstagramBot()
bot.prepare(username)
bot.login(username, password)

val user = "@mohsen_alak"
val howManyFollowersYouWantToFollow = 10

bot.followUserFollowers(user, howManyFollowersYouWantToFollow).collect { println(it) }

}` note) now the account is disabled

the log is belongs to convertToUserId() function in 439th line of InstagramBot class

hadiyarajesh commented 3 years ago

This was due to bug in case of user is not found on instagram. I've fixed it. Please check now.

mohsen2986 commented 3 years ago

i still face the same log . the function value.toLongOrNull()in convertToUserId throw these . i put valid and available username , but get the same log end errors. can u explain why use value.toLongOrNull() ? i replace that with correct function but still not work!

hadiyarajesh commented 3 years ago

You need to clone the updated repository as i've fixed the issue. It no more throw that error. value.toLongOrNull() is there to parse userId if userId is given in place of username.

hadiyarajesh commented 3 years ago

I've fixed another bug that was causing issue in getUserIdByName() method. Please check now.