marcelja / facebook-delete

Fast facebook activity deletion
MIT License
1.28k stars 48 forks source link

New custom flags, better debug info, updated default behavior and documentation #50

Closed AlexKalopsia closed 2 years ago

AlexKalopsia commented 2 years ago

Hi there! First of all thanks for making facebook-delete, it's a really awesome tool. I am opening this PR to address a few issues that I (and other users) have encountered.

Please note that this is the very first time I write code in Go and I am aware some of this code is quite ugly, but hopefully it can still be ok and maybe you can find time to give some input.

Here are the main changes:

Custom flags

This fixes (almost entirely) #42

As shown in the updated README.md, I am introducing a few flags to run the program more quickly from terminal:

-customYears: allows to define comma separated years and skip the menu selection -customMonths: allows to define comma separated months and skip the menu selection -selectAllContent: allows to select every content type and skip the menu selection

For the first two flags, I am running some regex to be sure the user types valid input. If the input is not valid, they will be asked for manual input as by default behavior.

For the months specifically, I made a map (pretty ugly, and I wonder if you have any input on how to make this suck less) that allows both single and double digits. I saw that the code base relies on strings (ie Jan, Feb, ...), but it felt more universal (and easier to validate input) to rely on digits instead. I also allow the option all to do full selection as well.

For content type I only put a single boolean because I didn't really have time to implement proper validation for each type of content.

Better debug info

While this doesn't fully fix #38, it does throw now a panic related to the program not being able to parse the cookies. It also points the user to the location of the cookie file that can be deleted to fix the issue. I have tried to manually nuke the cookies using RemoveAll() but with no positive result. The current solution is better than a generic out of range panic, though.

Updated default behavior

My experience is that with limitRate set to 0, Facebook will currently block your activity feed right away. Many other users reported the same issue. I do all my queries at 140000 ms rate now, and that's the only way I can currently circumvent the issue. Still, I set the new default to 30000 ms, and prompted the user to play around with this value a bit to find what works for them. Again, not ideal, but 0 is basically an insta-block right now :(

Documentation

Finally, I tried and document all of the above in the clearer way possible on the README.md file.


Once again, apologies if some of this code is really ugly. If you don't have time to review and don't want to merge that's also completely fine. Thanks again for making this tool available.