twint | advanced Twitter scraping & OSINT tool | Scraper library

 by   twintproject Python Version: 2.1.20 License: MIT

kandi X-RAY | twint Summary

kandi X-RAY | twint Summary

twint is a Python library typically used in Automation, Scraper applications. twint has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install twint' or download it from GitHub, PyPI.

No authentication. No API. No limits. Twint is an advanced Twitter scraping tool written in Python that allows for scraping Tweets from Twitter profiles without using Twitter's API. Twint utilizes Twitter's search operators to let you scrape Tweets from specific users, scrape Tweets relating to certain topics, hashtags & trends, or sort out sensitive information from Tweets like e-mail and phone numbers. I find this very useful, and you can get really creative with it too. Twint also makes special queries to Twitter allowing you to also scrape a Twitter user's followers, Tweets a user has liked, and who they follow without any authentication, API, Selenium, or browser emulation.

            kandi-support Support

              twint has a medium active ecosystem.
              It has 15023 star(s) with 2673 fork(s). There are 318 watchers for this library.
              It had no major release in the last 12 months.
              There are 522 open issues and 651 have been closed. On average issues are closed in 45 days. There are 68 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of twint is 2.1.20

            kandi-Quality Quality

              twint has 0 bugs and 0 code smells.

            kandi-Security Security

              twint has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              twint code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              twint is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              twint releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              twint saves you 1143 person hours of effort in developing the same functionality from scratch.
              It has 2581 lines of code, 127 functions and 23 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed twint and discovered the below as its top functions. This is intended to give you an instant insight into twint implemented functionality, and help decide if they suit your requirements.
            • Start the task
            • The main method
            • Sets the model s followers
            • Performs a search
            • Sends favorites
            • Render a user profile
            • Set sys stdout
            • Check the response of an Elasticsearch index creation
            • Create a Tweet index
            • Performs a search
            • Run Twint
            • Format a date
            • Sanitize query string
            • Load user list
            • Read a HDF5 file
            • Argument parser
            • Sets the profile
            • Sets favorites
            • Validate arguments
            • Add user to database
            • Create a DateLock object
            • Fetch tweets from job2
            • Fetch all the tweets
            • Convert obj to csv
            • Serializes obj to JSON
            • Read HDF5 file
            • Sets the following parameters
            • Sets the user s followers
            • Autocomplete function
            • Lookup users
            • Follow a user
            Get all kandi verified functions for this library.

            twint Key Features

            No Key Features are available at this moment for twint.

            twint Examples and Code Snippets

            TWINT - Twitter Intelligence Tool-Module Example
            Pythondot img1Lines of Code : 21dot img1License : Permissive (MIT)
            copy iconCopy
            import twint
            # Configure
            c = twint.Config()
            c.Username = "realDonaldTrump"
            c.Search = "great"
            # Run
            import twint
            c = twint.Config()
            c.Username = "noneprivacy"
            c.Custom["tweet"] = ["id"]
            c.Custom["user"] = ["bio"]
            c.Limit = 10  
            Module Example
            pypidot img2Lines of Code : 21dot img2no licencesLicense : No License
            copy iconCopy
            import twint
            # Configure
            c = twint.Config()
            c.Username = "realDonaldTrump"
            c.Search = "great"
            # Run
            import twint
            c = twint.Config()
            c.Username = "noneprivacy"
            c.Custom["tweet"] = ["id"]
            c.Custom["user"] = ["bio"]
            c.Limit = 1  
            Easy Twitter API,How to use this package?
            Pythondot img3Lines of Code : 14dot img3License : Permissive (Apache-2.0)
            copy iconCopy
                "ACCESS_KEY": "ggjhaglahdjkalghajk",
                "ACCESS_SECRET": "hfdajklfhadjkfha",
                "CONSUMER_KEY": "fhjdkalfhakjlfhasdkjlh",
                "CONSUMER_SECRET": "fhajklfhdajslfhda"
            from easy_twitter_api import EasyTwitterAPI
            scraper = EasyTwitterAPI(cre  
            How to reexecute if an error occurs in python?
            Pythondot img4Lines of Code : 20dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            except WhateverExceptionType:
            import time
                except WhateverExceptionType:
            var = What is this?
            Pythondot img5Lines of Code : 14dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            #Our code module
            data1 = None
            class ourClass:
                def __init__(self):
                   self.some_data = 0
            data1 = ourClass()
            import ourCode
            variable = ourCode.data1
            variable2 = ourCode.data1
            TypeError: replace() argument 2 must be str, not int
            Pythondot img7Lines of Code : 2dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            output = output.replace("{replies}", str(t.replies_count))
            copy iconCopy
            python3.6 -m pip install twint
            How to scrape twitter data from specific years and specific locations using Twint
            Pythondot img9Lines of Code : 3dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            searchstr = "(Covid-19) until:2021-02-19 since:2021-02-17)"
            c.Search = searchstr
            Python twint library is not working in Colab environment
            Pythondot img10Lines of Code : 19dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            !git clone --depth=1
            !cd /content/twint && pip3 install . -r requirements.txt
            import twint
            import nest_asyncio
            import time
            import pandas as pd
            import os
            import re

            Community Discussions


            How to reexecute if an error occurs in python?
            Asked 2021-Dec-16 at 17:52

            I'm working with Twint(a Twitter scraper) but somehow there is a problem that I can't fix. I wonder if there is a way that when an error occurs, wait 1 min and re-execute this? My code is like this:



            Answered 2021-Dec-16 at 16:28

            If you want to simply pretend the error didn't happen, you could do:



            var = What is this?
            Asked 2021-Dec-09 at 22:26

            I'm new with Python and I'm using Twint. In order to create a DataFrame from the scraped twits, I must run the following code:



            Answered 2021-Dec-09 at 22:09

            in Tweets_df is initially set to a None value it is likely that it is set to the value of a the object you're talking about at a later point in the code. So the code would look something like this.



            Trying to run a program from github which I've installed using pip3. But when I try to run in through the Mac OS terminal, it require's "Python 3.6+"
            Asked 2021-Dec-03 at 20:08

            Just new to everything coding, but I need to run a github program called "Twint"

            I've already installed all the requirements, even the latest Python but it still says

            "[-] TWINT requires Python version 3.6+.". Now upon some research, I shouldn't replace the default Python 2.7 with a new one to avoid messing up the system, but how am I going to run this program?

            Screenshot of MAC OS Terminal

            Any kind of help is highly appreciated.



            Answered 2021-Dec-03 at 20:08

            As mentioned in the repository in the question and upon reading the Installing section of the Readme,you have to do the following to install the tool :

            Navigate to the source code directory in the terminal (which you're already in , after looking at the screenshot) and then run the following code in the terminal :



            React native expo open url android web intent
            Asked 2021-Nov-08 at 11:10

            How can I open an installed Android app from a url like 'intent://payment#Intent;action=ch.twint.action.TWINT_PAYMENT;scheme=twint;S.code={token};S.startingOrigin=EXTERNAL_WEB_BROWSER;S.browser_fallback_url=;end'?

            Everytime I try Linking.openUrl() from expo-linking through the Expo Go client I get a console error. If I open it from the browser, it works fine.


            I saw this SO, which is basically what I need to do, but he's using flutter, and since I'm using Expo, I cannot add specific code.

            Convert intent web url to Android Intent

            I've seen Expo Linking has sendIntent() method, but I don't know how to convert this kind of URL to pass it to the method.



            Answered 2021-Nov-08 at 11:10


            I2C not reading
            Asked 2021-Oct-27 at 12:38

            I'm trying to interface with a BNO055 breakout board from a Teensy 2.0, but I'm having trouble reading from the BNO055. It has different registers that you can access to read data from the chip. To start, I'm just trying to read the IDs of some internal parts. No matter what I do, I seem to only get the last value that I put in TWDR. Trying to do a read doesn't seem to populate it. This is what I have in my main:



            Answered 2021-Oct-27 at 12:38

            This answer was written before the code in the question was updated in line with this answer. Not knowing this would confuse you as to how/why this answer(s|ed) the question.

            The basic problem you're having is that you're issuing I2C start conditions and I2C stop conditions in places where they don't belong. The START an STOP conditions go at the beginning and end of an entire I2C transaction and not around each individual byte.

            The data portion of a transaction is always entirely composed of data to be read or entirely composed of data to be written. So, performing a read of a register of a typical I2C device requires two I2C transactions. One involving writing the register address and the next involving reading the register's data, looking something like the following:

              The write-transaction were we inform the I2C device of the register we want to read data from.

              The read-transaction that conveys the data itself.

            Potentially the last stop of the first could/should be omitted to create a I2C "repeated start" (which you probably don't need). So as not to confuse matters, I'm just going to go with the above scheme.

            What you have, currently, looks more like this instead:

              You've an empty write transaction.
              Now a transaction that tries to use a device register address as an I2C bus address
              You've started a read transaction but didn't read any of the data that would follow if you issued a READ.
            • [I2C-START] [READ(?)] [I2C-STOP]
              An attempt to read when you're supposed to writing either a I2C address (for either a read or write transaction).

            The latter one is probably where you're getting in the most trouble and why you're seeing an unchanged TWDR; as an I2C master, you're never going to read a byte immediately following the start condition like that, since there's always supposed a byte written there containing address bits.

            Put in terms of your code, you'd want something like:



            Twitter timeline scraping error using Twint
            Asked 2021-Oct-19 at 16:04

            I have an issue whereby the Since command in twint does not appear to be working. I can only scrape Tweets from the past 10 days.

            I tried to modify the source files for twint as per the suggestion here but no luck:

            Does anybody have any suggestions of a fix? Or alternate packages?



            Answered 2021-Oct-19 at 16:04

            I recommend using snscrape for scraping any amount of tweets from an account or by keyword.

            You can find more info in this medium article on how to do it by keyword. Here is my code for scraping all tweets from a given account:



            How do I use the since and until parameters in twint?
            Asked 2021-Aug-29 at 17:04

            Im using the twint package to get all tweets in english since 2016-01-01 until 2021-01-01 for the search btc and save it as a csv file. My code looks as follow (im using a jupyter notebook)



            Answered 2021-Aug-29 at 17:04

            I had a similar issue. Try to delete and retype your hyphens (-) between numbers (if you copied/pasted into Jupyter Notebook). It worked for me!



            TypeError: replace() argument 2 must be str, not int
            Asked 2021-Aug-18 at 16:48

            I am trying to scrape for Tweets using Twint. The goal is to get tweets based on a keyword and print them according to the custom format provided by me. While setting up the twint configurations to scrape , I faced the following error



            Answered 2021-Aug-17 at 19:19

            The second parameter needs to be a str, not an int.

            Use this instead:



            Problem Importing Python Twint Module to Jupyter Notebook - ModuleNotFoundError: No module named 'twint'
            Asked 2021-Jul-16 at 02:18

            When I try to import the twint package ( to Jupyter Notebook, I get an error message.



            Answered 2021-Jul-16 at 02:18

            I had the same problem trying to start using twint this morning.
            It seems that twint is only compatible with python 3.6, whereas I was using a more recent version. I downloaded python 3.6, and ran



            How to read many files and export the numbers of rows in one table using pandas?
            Asked 2021-May-31 at 00:06

            Does anyone know how to initiate the loop to read all the files below and count the row in each table and export the number in one table? I use jupyter notebook to run the python (3.8) and use pandas to manipulate the data. I want to count how many tweets per day during certain period. I used twint to retrive the information and want to analyze the data.



            Answered 2021-May-30 at 13:19

            With Python 3.6+ you could use f-string formatting syntax to pad ({i:02}) the numbers generated with range. Optionally, use header=None to indicate that your data has no header, or, if does have, set the header value accordingly to obtain the exact number of valid data rows.


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install twint

            Details on setting up Elasticsearch with Twint is located in the wiki.


            If you have any question, want to join in discussions, or need extra help, you are welcome to join our Twint focused channel at OSINT team.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • PyPI

            pip install twint

          • CLONE
          • HTTPS


          • CLI

            gh repo clone twintproject/twint

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Scraper Libraries


            by soimort


            by twintproject


            by codelucas


            by FriendsOfPHP

            Try Top Libraries by twintproject


            by twintprojectGo


            by twintprojectHTML


            by twintprojectJavaScript


            by twintprojectGo


            by twintprojectPython