forked from woluxwolu/twint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom.py
36 lines (27 loc) · 813 Bytes
/
custom.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import twint.run
from twint import Config
import os
from dotenv import load_dotenv
config = Config()
config.User_id = "msam_cz"
# config.Search = "obsah"
config.Limit = 10
# config.deleted = True
# config.Replies = True
config.Replies = False
config.Impressions = True
# NOTE: will be indexed
config.Store_csv = True
## NOTE: reads tweets from the newest to the oldest
config.Since = "2023-04-01 20:30:15"
config.Until = "2023-05-01 20:00:00"
config.Output = "./output/impressions.csv"
load_dotenv()
x_csrf_token = os.environ.get("X_CSRF_TOKEN")
cookie = os.environ.get("COOKIE")
if x_csrf_token is None or cookie is None:
print("Please specify correct X_CSRF_TOKEN and COOKIE values in .env file.")
else:
config.X_csrf_token = x_csrf_token
config.Cookie = cookie
twint.run.Search(config)