Comments (4)
Hi, it's next in my to-do list
from deletetweets.
Adding an option to filter tweets by date in your existing JavaScript code can be a bit complex because Twitter's API does not provide direct filtering by date. However, you can modify your script to filter tweets by their creation date after fetching them. Here's how you can do that:
- Add a
filterByDate
function to filter tweets by date. This function will take theentries
(tweet data) as input and return filtered entries based on the date range you specify.
function filterByDate(entries, startDate, endDate) {
return entries.filter((tweet) => {
const createdAt = new Date(tweet["legacy"]["created_at"]);
return createdAt >= startDate && createdAt <= endDate;
});
}
- Define your desired date range by creating
startDate
andendDate
objects. For example, to filter tweets from January 1, 2023, to February 28, 2023:
const startDate = new Date("2023-01-01T00:00:00Z");
const endDate = new Date("2023-02-28T23:59:59Z");
- Modify your main loop to include date filtering. After fetching tweets using
fetch_tweets
, use thefilterByDate
function to filter the tweets based on the date range:
entries = await fetch_tweets(next);
entries = filterByDate(entries, startDate, endDate); // Apply date filtering
next = await log_tweets(entries);
await delete_tweets(tweets_to_delete);
tweets_to_delete = [];
await sleep(3000);
With these modifications, your script will fetch tweets and then filter them to include only those that fall within the specified date range. Make sure to adjust the startDate
and endDate
to match your desired date filtering criteria.
from deletetweets.
I don't know if it works, it's just theory. I hope it can help you ;)
from deletetweets.
I don't know if it works, it's just theory. I hope it can help you ;)
done, I added explanation how to do it in the readme :)
from deletetweets.
Related Issues (20)
- X-Client-Uuid not showing up HOT 1
- Removing RTs? HOT 1
- Guidance on Rate Limiting HOT 2
- Are you able to include "likes" & "media" removals as well? HOT 1
- How to stop it HOT 2
- doesn't delete threads HOT 1
- feature request: don't delete pinned tweet HOT 2
- "old tweets" and date ranges apparently don't work together HOT 6
- Please define the license HOT 1
- Retweets and likes HOT 2
- Add unlike option HOT 2
- how to remove media and reply tweets HOT 4
- "failed to load ressource :"...." the server responded with a status of 429 ( )" HOT 2
- 403(Forbidden) | "Network response was not ok, retrying in 10 seconds" on running script on console HOT 2
- fixing uuid not found problem (works only in chrome) HOT 2
- Uncaught TypeError: Cannot read properties of undefined (reading 'substring') at <anonymous>:8:32 (anonymous) @ VM75:8 HOT 1
- x-client-uuid no longer exists HOT 4
- Archive option doesn't seem to be deleting anything for some reason HOT 2
- Prints undefined and all posts are still there. HOT 3
- Suggestion: Language check HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deletetweets.