Instapy: BUG ALERT: (line.find(lineToDelete) < 0) will remove any username contain other user

Created on 1 Sep 2018  ·  8Comments  ·  Source: timgrossmann/InstaPy

line = '2018-08-24 13:11 ~ blondstudiotlv,'
lineToDelete ='blo'
line.find(lineToDelete) < 0 == TRUE !!!

bug wontfix

Most helpful comment

Actually just stepped into this issue couple days ago with my own account, it messed up my followed_pool file and my following just skyrocketed. thank you @sionking to point it out and thank you @uluQulu for the quick fix suggestion. I will PR the fix tonight if there isn't one exists yet. (another International business trip coming up soon, Getting super busy again :( )

All 8 comments

Also previous implementation will remove users ends with:
if not line.endswith(lineToDelete):

I hate regex, we need different approach

Those are bugs for 1 - 2 weeks application :(

@sionking
if line.split(" ~ ")[1] == lineToDelete:
for current style only ☝🏼

Considering old data having different structure,

## taken from `set_automated_followed_pool()` file:
"""
Data entry styles [historically]:
    user,   # oldest
    datetime ~ user,   # after `unfollow_after` was introduced
    datetime ~ user ~ user_id,   # after `user_id` was added
"""


## it must be checked vs all those conditions:

entries = line.split(" ~ ")
sz = len(entries)

if sz == 1:
    user = entries[0][:-2]

elif sz == 2:
    user = entries[1][:-2]

elif sz == 3:
    user = entries[1]

# OR

user = entries[0][:-2] if sz==1 else entries[1][:-2] if sz==2 else entries[1]

using CSV reader will be better there

Using regex will be slightly faster (_unnoticable speed_) and more simpler but using simple methods (_like in above_) will make things easier to understand and in future easier to maintain in case of data style changes.


Cheers 😁

Most ugly database :()
We really need to think of using something more modern.
I really like this:
https://github.com/RaRe-Technologies/sqlitedict

The serialize the data and store it in sqlite.

Actually just stepped into this issue couple days ago with my own account, it messed up my followed_pool file and my following just skyrocketed. thank you @sionking to point it out and thank you @uluQulu for the quick fix suggestion. I will PR the fix tonight if there isn't one exists yet. (another International business trip coming up soon, Getting super busy again :( )

@uluQulu I think we need your solution the one that @CharlesCCC implemented have the same bug
https://github.com/timgrossmann/InstaPy/pull/2863
But will fail when one user ends the same

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seuraltimez picture seuraltimez  ·  3Comments

ghost picture ghost  ·  3Comments

46960 picture 46960  ·  3Comments

ingorichter picture ingorichter  ·  3Comments

thisishotdog picture thisishotdog  ·  3Comments