interact_user_followers
and
follow_user_followers
are basically the same but with following == 100% ?
Why don't we merge every thing to one big function that gets parameters instead of duplicating functions?
Another thing, this "percentage" system is not good, you can end up with a user that pass validation and not do any action.
@sionking You are absolutely right about this!
The follow_user_...
was the first thing that was added when one "client" wanted to interact with the follower of another account.
When we started to add interact_user_...
the idea was to, at one moment only have features that are of this kind, giving the user the best control over liking, following, commenting etc.
However, deprecating is kind of weird and the interact_user_...
wasn't quite there for a long time.
At one point we just kept both instead of removing one since people used it and would need to change their quickstart.
However, you are absolutely right and I'm sure this is the right way to go.
Removing it should actually be fine now.
The main idea of the percentage is to add more random behaviour.
Interacting with anyone who passes validation might be too suspicious in some situations.
Also, if you do e.g. .like_by_tags(['vegan'], amount=100)
and you run it automatically, it might like exactly 100 posts every time, which is very weird.
I absolutely understand the point, however what would be your approach here?
(I actually had to explain the percentage several times because it wasn't clear from the documentation alone)
Thank you for investing so much time into thinking about approaches and considerations
1.
The solution should be simple:
follow_user_ will call interact_user_ with following == 100%
this is how you save the function and make it without any content.
2.
.like_by_tags(['vegan'], amount=100)
If you enter an image and it is not validate so you are not interacting with every post.
amount can be randomize 80-120
Also simple solution.
But to skip a valid user is bad since some may use a very strict validation (image reco and stuff that cost money).
@sionking True. Those are simple solutions.
However they only solve the issues partially.
We'll still have two methods, not solving the "too many functions of the same type" issue, "only" reducing some code. Don't get me wrong, this is really good since it makes things easier to manage.
But in the "best" case, it's removed completely, still keeping the documentation in the README but updating it to the interact function, keeping the description the same.
(Of course, this is severe since it will break some peoples setups. So your approach, for now is, I guess, the better one.)
I agree, it definitely looks cleaner and less confusing. However I know several people who only use stuff like ['nsfw', 'sex', '...']
as restrictions. In a lot of cases they will get the exact given amount, probably several sessions after each other which might be malicious.
Adding the randomisation internally will confuse a lot of people since if they provide 100, they most likely want to see 100 in the execution.
Especially for commenting and following, I don't see how it can be done easily and still keep the control by the user.
I totally agree that some validations are expensive in terms of API calls etc.
@timgrossmann
Hi guys ๐๐ผโโ๏ธ
I got super busy time but I will join this conversation ๐๐ผ NOW
@sionking
interact_user_followers()
andfollow_user_followers()
are basically the same but with following == 100% ?
Nope.
follow_user_followers()
does interaction (the rest of the actions- like, comment) only if the user is followed WHEREAS interact_user_followers()
does all of the possible actions free of each other (_except comments WHICH needs the image to be _liked__)
I have written about this case in some other threads earlier in details and EVEN while adding the interact capability to the follow_user_followers()
(_and some similar features_), I thought of THE SAME THING- "_Duplication of Features?_" and once I realized that RED LINE I quit my idea to merge them.
Why don't we merge every thing to one big function that gets parameters instead of duplicating functions?
I will say one more thing here. There can be some brain work on feature designs and only after that these so similar features can be simplified.
e.g.,
having a NEW feature call template and give it an action priority like - do action only after follow is done, etc. [QUICK IDEA]
But else than that those features should remain as they are.
"percentage" system is not good
I really like the randomization comes with that mechanism and I also think it must be revised in general scope.
@timgrossmann
I totally agree that some validations are expensive in terms of API calls etc.
Well, I think it is up to people. If the user wants strict validation, it will [POSSIBLY] end up with lots of skipped users and the vice verse is clear.
The good thing is it is pretty OPTIONAL ๐๐ผ
@uluQulu
Nope.
follow_user_followers()
does interaction (the rest of the actions- like, comment) only if the user is followed WHEREASinteract_user_followers()
does all of the possible actions free of each other (_except comments WHICH needs the image to be _liked__)
100% follow will end up following the user ....
I really like the randomization comes with that mechanism and I also think it must be revised in general scope.
it is important but need to be used wisely.
Hey @sionking ๐ง
100% follow will end up following the user ....
Nope again.
interact_user_followers()
with the follow percentage of 100
%
follow_user_followers()
To sum up those SO SIMILAR LOOKING features,
it is important but need to be used wisely.
I hope you do not mean to remove it completely ๐
IMHO it should remain as is until gets a MUCH BETTER design WHILST preserving the IDEA it served to
@uluQulu
interact_user_followers()
with the follow percentage of100
%
- follow failed scenario [out of _restriction_, _validation_, etc.]
- will try to like and then comment [if any] โญ like = 0%, comment =0%
follow_user_followers()
- follow failed scenario [out of _restriction_, _validation_, etc.]
- will skip other actions [if any] โ
I don't get it, the only different is the action order ... We can do a flag for it :)
@sionking
I will explain myself in simplest words ๐ this time
interact_user_followers()
with the given actions: [follow, like, comment] all with the percentage of 100%While visiting a target user, if the follow action fails [out of certain reasons] it will still put like on the photos of that target user and even then will try to comment.
follow_user_followers()
with the interaction with given actions: [like, comment] all with the percentage of 100%While visiting a target user, if the follow action fails [out of certain reasons] it will NOT put like on the photos of that target user and also then will NOT try to comment.
See the difference? ๐
follow_user_followers()
attempts to interact [like, like+comment] on the target user ONLY AFTER follow was accomplished successfully WHILST interact_user_followers()
does not care of the follow being accomplished or not and tries other actions [like, like+comment].@sionking True. Those are simple solutions.
However they only solve the issues partially.
- I agree, it definitely looks cleaner and less confusing. However I know several people who only use stuff like
['nsfw', 'sex', '...']
as restrictions. In a lot of cases they will get the exact given amount, probably several sessions after each other which might be malicious.
Adding the randomisation internally will confuse a lot of people since if they provide 100, they most likely want to see 100 in the execution.
Especially for commenting and following, I don't see how it can be done easily and still keep the control by the user.
can be added to the documentation and quickstart.py:
import random
....amount=random.randint(80,120)
@uluQulu
Please check the code:
following = (random.randint(0, 100) <= self.follow_percentage and
self.do_follow and
not_dont_include and
not follow_restrected)
validation, details = validate_username(self.browser,
person,
self.username,
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
All you are asking is not to interact with already interacted users, which we have black list for there is no sense of making another function instead of using blacklist/new flag(dont interact on follow fail).
BTW I moved all of the rolling stuff to decisions making algo:
https://github.com/timgrossmann/InstaPy/pull/2925/files
So after validation we can know if we should follow, just add a flag "jump when not follow".
We can also add it to validate_user.
As I said it is just a small different no need to maintain 5 functions for it !
@sionking True. Those are simple solutions.
However they only solve the issues partially.
- I agree, it definitely looks cleaner and less confusing. However I know several people who only use stuff like
['nsfw', 'sex', '...']
as restrictions. In a lot of cases they will get the exact given amount, probably several sessions after each other which might be malicious.
Adding the randomisation internally will confuse a lot of people since if they provide 100, they most likely want to see 100 in the execution.
Especially for commenting and following, I don't see how it can be done easily and still keep the control by the user.
can be added to the documentation and quickstart.py:import random ....mount=random.randint(80,120)
It is as simple as randomize the amount .... don't make it more than it.
@sionking
All you are asking is not to interact with already interacted users, which we have black list for there is no sense of making another function instead of using blacklist/new flag(dont interact on follow fail).
No. I am not asking NOT TO INTERACT WITH ALREADY INTERACTED USERS. It is something unrelated.
I really find it hard WHY you did not see the difference of those features ๐
As I said it is just a small different no need to maintain 5 functions for it !
Right, that's what I also agree. Those features has lots of similarity and maintenance wins in a good refactor.
The THING I touched above is THAT those features are not THE SAME with some quick tweak on follow percentage.
I see you have added a few and
conditions, well, there are several THINGS that can make follow fail and covering all of them is IMPOSSIBLE [practically].
IF you want to solve that problem fully, control it with the follow_state
value just after trying to follow.
I will not enter into details cos of not having enough time.
But my suggestions are,
Hint: smells of feature_in_feature()
can be used there for an efficient solution ๐
@uluqulu
you don't follow... as you said you will not interact with a user you Don't follow.
While visiting a target user, if the follow action fails [out of certain reasons] it will NOT put like on the photos of that target user and also then will NOT try to comment.
it is one simple flag, or if you look at it now we won't follow only if this user INTERACTED BEFORE and I don't understand why you write so much about it.
I have read through all the comments. It seems like there are some interpretation different between how each function works. So I will leave that part for now.
goes back to the original statement @sionking made
Why don't we merge every thing to one big function that gets parameters instead of duplicating functions?
I wouldn't agree with this at all, I might not be the best coder out there, but I'm a HUGE believer of clean code
, As the code is written for computer to execute but for human to READ
.
Here are my two cents:
So, never big function with tons of parameters. There are something called KISS
principle, keep each function small and simple, make the codebase more modular, easier to debug and easier to modify is essential.
Especially for large community project like this (5500+ stars is amazing, you guys are creating something fantastic here), readability and maintainability is important. (There are chances I will have to spend a lots of time to read through the code to make small changes) The idea is make this project easier for others to make change/improvement. then, more people will able to get involved with contribution. Also it will make us easier to code review change and merge PR when needed.
@CharlesCCC you absolutely right.
Big function can be made of small functions, I just hate seen so much duplication for example:
validate_user function call in the code for more than 15 times ! that is insane.
While a flow of most functions is the same with a very small change.
I btw, only use 3-5 functions interact_by_user , interact_by_tag/loc follow user follower...
But I do have 10-15 different reuse of them.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. > If this problem still occurs, please open a new issue
Most helpful comment
@CharlesCCC you absolutely right.
Big function can be made of small functions, I just hate seen so much duplication for example:
validate_user function call in the code for more than 15 times ! that is insane.
While a flow of most functions is the same with a very small change.
I btw, only use 3-5 functions interact_by_user , interact_by_tag/loc follow user follower...
But I do have 10-15 different reuse of them.