minamotorin / twint

An advanced Twitter scraping & OSINT tool written in Python that doesn't use Twitter's API, allowing you to scrape a user's followers, following, Tweets and more while evading most API limitations.
MIT License
46 stars 16 forks source link

[BUG] No Header on CSV Result #7

Open NexiaMoe opened 2 years ago

NexiaMoe commented 2 years ago

Initial Check

Command Ran

I'm using twint as module, here code I use :

c = twint.Config()
c.To = "JeniusConnect"
c.Replies = False
c.Retweets = False
c.Store_csv = True
c.Output = "JeniusConnect.csv"
c.Custom['tweet'] = ["id", 'date', 'time', 'user_id', 'username', 'name', 'tweet']
c.Since = '2022-03-10'
c.Until = '2022-03-14'

twint.run.Search(c)

Description of Issue

Using Output as CSV and Store_csv = True, Result of CSV is correct but no header, the original twint have header when file is not exist or empty. Is it bug ?

It's not a problem for me, just it not convenient since I need to make it automate,

Environment Details

Using Windows 11 with WSL Ubuntu 20.04, run with python file (Twint as module)

minamotorin commented 2 years ago

Hi.

After running the code, the result of cat JeniusConnect.csv | head -1 (get the first line of JeniusConnect.csv) is id,date,time,user_id,username,name,tweet in my environment.

What does “no header” mean? or is this different from your environment?

NexiaMoe commented 2 years ago

My Bad, if file is not exist, it will add header

but if file exist, and it empty, it will not add header, but in original twint, it will add header if file exist.

minamotorin commented 2 years ago

I tested your code using the original twint, but the original twint didn't add header if file exists and is empty. The first line of JeniusConnect.csv is 1503154389866844163,2022-03-13,23:41:48,1351839832079650818,tchamomilee,ChuSangchuuu~,(tweet text).