<jupyter_start><jupyter_text>Twint Package<jupyter_code>import twint
import nest_asyncio
import pandas as pd
import sys, os
import time
from tqdm import trange
# Solve compatibility issues with notebooks and RunTime errors.
nest_asyncio.apply()
# I was diagnosed with deprssion
# I am fighting depression 
# I suffer from depression
DEFAULT_KEYWORD="I was diagnosed with depression"
DEFAULT_LIMIT=400
def get_keywords_tweets(keyword=DEFAULT_KEYWORD, limit=DEFAULT_LIMIT):
    c = twint.Config()
    c.Search = keyword
    c.Limit = limit
    c.Store_csv = True
    c.Output = (keyword+".csv")
    sys.stdout = open(os.devnull, 'w')
    print(twint.run.Search(c))
get_keywords_tweets()
key_words = ["I am diagnosed with depression",'I am fighting depression','I suffer from depression']
data = pd.DataFrame() 
for key in key_words:
    data =data.append( pd.read_csv(key+".csv")) 
len(data)
data = data.drop_duplicates(subset=['user_id'], keep='first') #To drop duplicate usernames 
len(data)
data['tweet'].iloc[0],data['username'].iloc[0]
user_name=data['username'].iloc[0]
def get_profile_infos(user_name=user_name):
    c = twint.Config()
    c.Username = user_name
    c.Store_csv = True
    c.Output = ("Profileinfos.csv")
    sys.stdout = open(os.devnull, 'w')
    twint.run.Lookup(c)

get_profile_infos()
profiles=pd.read_csv("Profileinfos.csv")
for i in trange(len(data)):
    get_profile_infos(data['username'].iloc[i])
user_name=data['username'].iloc[0]
def get_timeline_by_usernames(user_name=user_name):
    c = twint.Config()
    c.Username =user_name
    c.Retweets = True
    c.Limit=100
    c.Store_csv = True
    c.Output = ("Timelines/"+user_name+".csv")
    sys.stdout = open(os.devnull, 'w')
    twint.run.Search(c)
        
for i in trange(len(data)):
    get_timeline_by_usernames(data['username'].iloc[i])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13301023155627356, 'fraction_numerical': 0.005385029617662897, 'mean_word_length': 4.824451410658307, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '128238', 'license': 'Apache-2.0', 'n_tokens_mistral': 674, 'n_tokens_neox': 667, 'n_words': 140, 'path': 'Notebooks/Explore_Twint.ipynb', 'repo_name': 'BouzidiImen/Social_media_Prediction_depression', 'size': '1857'}