All Projects → philippe2803 → twitter-analytics-wrapper

philippe2803 / twitter-analytics-wrapper

Licence: other
A simple Python wrapper to download tweets data from the Twitter Analytics platform. Particularly interesting for the impressions metrics that are unavailable on current Twitter API. Also works for the videos data.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to twitter-analytics-wrapper

Real Time Sentiment Tracking On Twitter For Brand Improvement And Trend Recognition
A real-time interactive web app based on data pipelines using streaming Twitter data, automated sentiment analysis, and MySQL&PostgreSQL database (Deployed on Heroku)
Stars: ✭ 127 (+188.64%)
Mutual labels:  twitter, tweets, data-analysis
Model Describer
model-describer : Making machine learning interpretable to humans
Stars: ✭ 22 (-50%)
Mutual labels:  data-mining, analytics, data-analysis
Sourced Ce
source{d} Community Edition (CE)
Stars: ✭ 153 (+247.73%)
Mutual labels:  data-mining, metrics, data-analysis
gnip
Connect to Gnip streaming API and manage rules
Stars: ✭ 28 (-36.36%)
Mutual labels:  twitter, tweets
genie
Genie: A Fast and Robust Hierarchical Clustering Algorithm (this R package has now been superseded by genieclust)
Stars: ✭ 21 (-52.27%)
Mutual labels:  data-mining, data-analysis
congresstweets
Datasets of the daily Twitter output of Congress.
Stars: ✭ 76 (+72.73%)
Mutual labels:  twitter, tweets
Awesome-DataScience-Cheatsheets
Collection of cheatsheets for data science, machine learning and deep learning :).
Stars: ✭ 48 (+9.09%)
Mutual labels:  data-mining, analytics
popular restaurants from officials
서울시 공무원의 업무추진비를 분석하여 진짜 맛집 찾기 프로젝트
Stars: ✭ 22 (-50%)
Mutual labels:  data-mining, data-analysis
download-tweets-ai-text-gen-plus
Python script to download public Tweets from a given Twitter account into a format suitable for AI text generation
Stars: ✭ 26 (-40.91%)
Mutual labels:  twitter, tweets
TwEater
A Python Bot for Scraping Conversations from Twitter
Stars: ✭ 16 (-63.64%)
Mutual labels:  twitter, tweets
awesome-twitter-bots
A Curated Collection of the Best Twitter Bots 🤖
Stars: ✭ 99 (+125%)
Mutual labels:  twitter, tweets
FSCNMF
An implementation of "Fusing Structure and Content via Non-negative Matrix Factorization for Embedding Information Networks".
Stars: ✭ 16 (-63.64%)
Mutual labels:  data-mining, analytics
detweet
delete tweets en masse
Stars: ✭ 14 (-68.18%)
Mutual labels:  twitter, tweets
covid-19
COVID-19 World is yet another Project to build a Dashboard like app to showcase the data related to the COVID-19(Corona Virus).
Stars: ✭ 28 (-36.36%)
Mutual labels:  analytics, data-analysis
taller SparkR
Taller SparkR para las Jornadas de Usuarios de R
Stars: ✭ 12 (-72.73%)
Mutual labels:  data-mining, data-analysis
mood
Twitter analytics using textbox
Stars: ✭ 15 (-65.91%)
Mutual labels:  twitter, analytics
Social-Media-Monitor
Automatically monitor and log fan counters from social media(Facebook Pages, Twitter, Instagram, YouTube, Google+, OneSignal, Alexa) using APIs to Google Spreadsheet. Very useful for website admins and social media managers.
Stars: ✭ 36 (-18.18%)
Mutual labels:  twitter, analytics
Archive-Tweets
Archive and Delete Liked and Posted Tweets
Stars: ✭ 28 (-36.36%)
Mutual labels:  twitter, tweets
growthbook
Open Source Feature Flagging and A/B Testing Platform
Stars: ✭ 2,342 (+5222.73%)
Mutual labels:  analytics, data-analysis
python-notebooks
A collection of Jupyter Notebooks used in conferences or just to have some snippets.
Stars: ✭ 14 (-68.18%)
Mutual labels:  data-mining, data-analysis

Twitter analytics downloader

This script downloads the tweets report from the analytics section of a twitter account (including impressions). You can specify dates for period longer than the last 28 days default period from the Twitter analytics interface.

The twitter analytics platform used to have a limit of 91 days. In the latest iteration Twitter allows for periods of a month worth of data to be doenloaded. For periods longer thatn 28-31 days the script splits the downloading of reports in multiple requests.

This was created so we can get impressions data for every tweets as there is no API endpoints specifically for those metrics (as of today).

Installation

Selenium uses a few binaries (Chromedriver, xvfb) that needs to be installed beforehand with the following command:

$ sudo apt-get install chromium-chromedriver xvfb

Then you can install the library with pip

$ pip install twitter-analytics

A simple download for the last 28 days (default period) is done as follow:

from twitter_analytics import ReportDownloader


reports = ReportDownloader(
    username='<twitter username>',
    password='<twitter password>',
)

report_filepath = reports.run()

For specific date range and/or period over 90 days, you can launch the report download as follow:

from twitter_analytics import ReportDownloader
import csv


reports = ReportDownloader(
    username='<twitter username>',
    password='<twitter password>',
    from_date='03/28/2014',         # must be in string format 'mm/dd/yyyy' and nothing before October 2013 (twitter restriction).
    to_date='12/31/2016'
)

reports_filepath = reports.run()            # list of filepaths of downloaded csv reports

# Then you can parse the csv simply as follow
tweets = list()
for report in reports_filepath:
    with open(report, 'r') as csvfile:
        r = csv.DictReader(csvfile)
        rows = [row for row in r]
        tweets += rows

If you encounter issues, submit it on this repo. I also accept pull requests.

Mac OS install prerequisites

  • xvfb: Install XQuartz. Download the installer from here.

  • Chromedriver: The easiest way to obtain this is via Homebrew:

    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
    $ brew tap homebrew/cask
    $ brew cask install chromedriver
    

Please note that chromedriver was migrated from homebrew/core to homebrew/cask.

If you are installing from this repository:

  1. Clone/Download (and unzip) this repo in a known location in your computer

  2. Open a terminal and navigate to the location chosen for step 1

  3. In the terminal type the following

    python setup.py install --force
    

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].