How to use the twarc.json2csv.text function in twarc

To help you get started, we’ve selected a few twarc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DocNow / twarc / utils / search.py View on Github external
parser.add_argument('files', metavar='FILE', nargs='*', default=['-'], help='files to read, if empty, stdin is used')

args = parser.parse_args()

flags = 0
if args.ignore:
    flags = re.IGNORECASE

try:
    regex = re.compile(args.regex, flags)
except Exception as e:
    sys.exit("error: regex failed to compile: {}".format(e))

for line in fileinput.input(files=args.files):
    tweet = json.loads(line)
    text = json2csv.text(tweet)
    if regex.search(text):
        print(line, end='')

twarc

Archive tweets from the command line

MIT
Latest version published 1 year ago

Package Health Score

50 / 100
Full package analysis

Similar packages