0

I have an app that uses sql queries & js and python files, and connects to the twitter api to get user data initially with specific seeded user accts in a database, in order to build a larger database that constantly analyzes using page rank, so that it can achieve the end goal of finding new crypto twitter accounts under 10-20 followers.

I am having an issue connecting to the twitter api, lol. And I understand that this is something spoken about, what seems like every day. However, there are still apps like, https://www.vicinitas.io/free-tools/download-twitter-followers and https://phantombuster.com/, that are able to retrieve 5,000-7,500 followers, per request.

How are they able to achieve this?

I know that theyre no longer paying for the api, yet they can still retrieve a user's followers.

I run this with all of the credentials, and just get API error.

There is not a step by step walkthrough, of connecting to the twitter api.

I do have a dev acct. I create an app and then retrieve all of the credentials.

The access token, access token secret, api key, api key secret and bearer token.

I create a project and then I create an app.

If adding user authentication is the issue then,

Read
Read and Write 
Read and Write and DM

Native App or
Web App
Callback URI / Redirect URL (required) 
https:// or scheme://

Add another URI / URL

Website URL (required)
https://

The above is for if someone thinks that it is the API connection setup, these are the options.

This below, is code that I have been using.

import discord
import tweepy
import asyncio
import time

# Twitter API Credentials
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
bearer_token = ''

# Discord Credentials
WEBHOOK_ID = ''
BOT_TOKEN  = ''

# Authenticate to Twitter
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

# Authenticate to Discord
intents = discord.Intents.default()  # Create an instance of the default intents
client = discord.Client(intents=intents)  # Pass the intents to the Client constructor

# Define the tracked users
tracked_users = {"": []}  # Replace "example_user" with the desired user ID or screen name

# Run the bot
client.run(BOT_TOKEN)


async def check_followings():
    while True:
        for user in tracked_users.keys():
            try:
                # Fetch the IDs of the users that the user is following.
                current_following_ids = api.friends_ids(user)
                for following_id in current_following_ids:
                    # If this ID wasn't in the list before
                    if following_id not in tracked_users[user]:
                        tracked_users[user].append(following_id)
                        new_followed_user = api.get_user(following_id)
                        profile_info = f"Name: {new_followed_user.name}\nBio: {new_followed_user.description}\n" \
                                       f"Profile Picture URL: {new_followed_user.profile_image_url}\n" \
                                       f"Followers Count: {new_followed_user.followers_count}\n" \
                                       f"Tweets Count: {new_followed_user.statuses_count}\n"

                        channel = client.get_channel(CHANNEL_ID)
                        await channel.send(f'@{user} has just followed a new user: @{new_followed_user.screen_name}.\n{profile_info}')

            except Exception as e:
                print(f"Error: {str(e)}")
        time.sleep(300)  # wait for 5 minutes


@client.event
async def on_ready():
    print(f'We have logged in as {client.user}')
    client.loop.create_task(check_followings())

client.run(BOT_TOKEN)

And I would like to thank anyone beforehand, for reading this post, or adding anything to it.

ja98
  • 1

0 Answers0