bouiboui / facebook-saved

Export saved links from Facebook
https://chrome.google.com/webstore/detail/export-saved-links/ecpknffljbjgdccapjaflmpfoclakjcg
17 stars 0 forks source link

[IDEA] Support bulk delete saved items in facebook #6

Closed 2ge closed 3 years ago

2ge commented 4 years ago

A lot of users are searching how to bulk delete saved items. For example I have 4500+ items in https://www.facebook.com/saved/ and there is no way how I can delete them, except to do it one by one. I think with small change of your great program you could save me another few hours of work...and not only me.

bouiboui commented 3 years ago

Thanks for your suggestion, and sorry for the delay!

That's a nice idea, I use a bit of code magic* to do it myself, I can definitely add it to the extension, I just need to think about the UI / UX (what it should look like for the user, I don't think it should be fully automatic). If you have suggestions I'm all ears.

*Basically, I'm searching for elements with "Unsave" as text and click on them automatically.

akryvtsun commented 3 years ago

I definitely need all Facebook items delete too! Pls, add this to your code.

akryvtsun commented 3 years ago

@bouiboui could you share here your magic to delete all FB items? I have around 2k saved items and physically can't delete all of them manually :(

bouiboui commented 3 years ago

I have Facebook's new design now, old version was easier but I don't remember it.

It takes several steps:

Warning: All the items displayed on the page will be unsaved, permanently.

akryvtsun commented 3 years ago

@bouiboui I've just shocked: can remove ~2k saved items no longer than 20 min with you help! Thank you so much! I'm going to integrate you solution in your plugin. Will try to create PR for your code...

bouiboui commented 3 years ago

That's nice, you can ask me anything if you need help.

gianchub commented 2 years ago

I have Facebook's new design now, old version was easier but I don't remember it.

It takes several steps:

Warning: All the items displayed on the page will be unsaved, permanently.

  • Scroll down to display all the links you want to unsave
  • Run this in your console to open the contextual menu on each item:
Array.from(document.querySelector('[role=main]').querySelectorAll('[aria-label="More"]')).slice(1).map(e => e.click())
  • Run this to click on "Unsave" on each of them:
Array.from(document.querySelectorAll('[role=menuitem]')).map(e => e.click())

Warning: All the items displayed on the page will be unsaved, permanently.

Sooo cool! Thank you for this!

2ge commented 2 years ago

facebook is blocking too fast requests, I am no JS master, but this works for me:

// 1) click links to see UNSAVE function
var links = Array.from(document.querySelector('[role=main]').querySelectorAll('[aria-label="More"]')).slice(1)

// Returns a Promise that resolves after "ms" Milliseconds
const timer = ms => new Promise(res => setTimeout(res, ms))

async function load () { // We need to wrap the loop into an async function for this to work
  for (var i = 0; i < links.length; i++) {
    console.log(links[i]);
    links[i].click();
    await timer(1100); // then the created Promise can be awaited
  }
}
load();

//2) click on UNSAVE function
var links = Array.from(document.querySelectorAll('[role=menuitem]'))

// Returns a Promise that resolves after "ms" Milliseconds
const timer = ms => new Promise(res => setTimeout(res, ms))

async function load () { // We need to wrap the loop into an async function for this to work
  for (var i = 0; i < links.length; i++) {
    console.log(links[i]);
    links[i].click();
    await timer(1100); // then the created Promise can be awaited
  }
}

load();