Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This code is for delete all the tweets of your profile
/**
* This code work in the https://mobile.twitter.com/YOUR_USERNAME/with_replies
*
*/
const _this = $;
const clickFirstElement = () => {
_this(
".css-18t94o4.css-1dbjc4n.r-1777fci.r-11cpok1.r-1ny4l3l.r-bztko3.r-lrvibr"
).click();
setTimeout(() => {
deleteElement();
}, 1000);
};
const deleteElement = () => {
_this(
".css-1dbjc4n.r-1loqt21.r-18u37iz.r-779j7e.r-23eiwj.r-o7ynqc.r-6416eg.r-13qz1uu"
).click();
setTimeout(() => {
confirmDelete();
}, 1500);
};
const confirmDelete = () => {
_this(
".css-18t94o4.css-1dbjc4n.r-1dgebii.r-42olwf.r-sdzlij.r-1phboty.r-rs99b7.r-16y2uox.r-1w2pmg.r-145lgeb.r-9u3a9d.r-1fneopy.r-o7ynqc.r-6416eg.r-lrvibr"
).click();
setTimeout(() => {
window.scrollBy(0, 300);
clickFirstElement();
}, 3000);
};
clickFirstElement();
@tejxv
Copy link

tejxv commented May 18, 2020

this doesn't work :(
returns the following error-

 Uncaught TypeError: Cannot read property 'click' of null
    at deleteElement (<anonymous>:14:4)
    at <anonymous>:7:5

@krrskl
Copy link
Author

krrskl commented May 23, 2020

@tejxv This code alone work in https://mobile.twitter.com/**YOUR_USERNAME**/with_replies

@krystynhi
Copy link

krystynhi commented Jun 10, 2020

I get this error in Chrome 83.0.4103.97 on https://twitter.com/heide/with_replies. I am logged in to Twitter and all of my Chrome extensions are disabled. Hope this helps!

VM2170:14 Uncaught TypeError: Cannot read property 'click' of null
    at deleteElement (<anonymous>:14:4)
    at <anonymous>:7:5

@Throwaway-MM
Copy link

Throwaway-MM commented Jun 10, 2020

I get this error in Chrome 83.0.4103.97 on https://twitter.com/heide/with_replies. I am logged in to Twitter and all of my Chrome extensions are disabled. Hope this helps!

VM2170:14 Uncaught TypeError: Cannot read property 'click' of null
    at deleteElement (<anonymous>:14:4)
    at <anonymous>:7:5

This gist hard coded the fixed div selector classes that do not match the obfuscated changing REACT UI that matches widely other things breaking the execution chain running as infinite recursion to itself. My gist uses data selectors that should stay more consistent around among other things, try this:
https://gist.github.com/FocusWho/5a8e74895293eae0071cec612477c72f

@meiblorn
Copy link

meiblorn commented Feb 13, 2021

/**
 * This code work in the https://mobile.twitter.com/YOUR_USERNAME/with_replies
 * 
 */
const _this = $;
const clickFirstElement = () => {
  _this(
    ".css-18t94o4.css-1dbjc4n.r-1777fci.r-11cpok1.r-1ny4l3l.r-bztko3.r-lrvibr"
  ).click();
  setTimeout(() => {
    deleteElement();
  }, 1000);
};

const deleteElement = () => {
  _this(
    ".css-901oao.r-daml9f.r-1qd0xha.r-a023e6.r-16dba41.r-ad9z0x.r-bcqeeo.r-qvutc0"
  ).click();
  setTimeout(() => {
    confirmDelete();
  }, 1500);
};

const confirmDelete = () => {
  _this(
    ".css-901oao.r-1awozwy.r-jwli3a.r-6koalj.r-18u37iz.r-16y2uox.r-1qd0xha.r-a023e6.r-b88u0q.r-1777fci.r-ad9z0x.r-dnmrzs.r-bcqeeo.r-q4m81j.r-qvutc0"
  ).click();
  setTimeout(() => {
    window.scrollBy(0, 300);
    clickFirstElement();
  }, 3000);
};

clickFirstElement();

@iMaz1n
Copy link

iMaz1n commented Mar 3, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment