{"id":51139614,"url":"https://github.com/philippe2803/twitter-analytics-wrapper","last_synced_at":"2026-06-25T21:02:57.665Z","repository":{"id":62585743,"uuid":"88612425","full_name":"philippe2803/twitter-analytics-wrapper","owner":"philippe2803","description":"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.","archived":false,"fork":false,"pushed_at":"2018-12-27T20:59:48.000Z","size":57,"stargazers_count":46,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-10T03:14:36.252Z","etag":null,"topics":["analytics","analytics-api","data-analysis","data-mining","impression","metrics","python-library","python2","python3","tweets","twitter","twitter-analytics-platform","video-statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philippe2803.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-18T10:26:55.000Z","updated_at":"2024-07-31T18:19:07.000Z","dependencies_parsed_at":"2022-11-03T22:05:42.383Z","dependency_job_id":null,"html_url":"https://github.com/philippe2803/twitter-analytics-wrapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/philippe2803/twitter-analytics-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philippe2803%2Ftwitter-analytics-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philippe2803%2Ftwitter-analytics-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philippe2803%2Ftwitter-analytics-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philippe2803%2Ftwitter-analytics-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philippe2803","download_url":"https://codeload.github.com/philippe2803/twitter-analytics-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philippe2803%2Ftwitter-analytics-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34792207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","analytics-api","data-analysis","data-mining","impression","metrics","python-library","python2","python3","tweets","twitter","twitter-analytics-platform","video-statistics"],"created_at":"2026-06-25T21:02:57.029Z","updated_at":"2026-06-25T21:02:57.660Z","avatar_url":"https://github.com/philippe2803.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Twitter analytics downloader\n========\n\nThis script downloads the tweets report from the analytics section of a twitter account (including impressions). \nYou can specify dates for period longer than the last 28 days default period from the Twitter analytics interface.\n\nThe 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.\n\nThis was created so we can get impressions data for every tweets as there is no API endpoints specifically for those metrics (as of today).\n\n\nInstallation\n\nSelenium uses a few binaries (Chromedriver, xvfb) that needs to be installed beforehand with the following command:\n\n```commandline\n$ sudo apt-get install chromium-chromedriver xvfb\n```\n\nThen you can install the library with pip\n\n\n```commandline\n$ pip install twitter-analytics\n\n```\n\n\nA simple download for the last 28 days (default period) is done as follow:\n\n```python\nfrom twitter_analytics import ReportDownloader\n\n\nreports = ReportDownloader(\n    username='\u003ctwitter username\u003e',\n    password='\u003ctwitter password\u003e',\n)\n\nreport_filepath = reports.run()\n```\n\nFor specific date range and/or period over 90 days, you can launch the report download as follow:\n\n```python\nfrom twitter_analytics import ReportDownloader\nimport csv\n\n\nreports = ReportDownloader(\n    username='\u003ctwitter username\u003e',\n    password='\u003ctwitter password\u003e',\n    from_date='03/28/2014',         # must be in string format 'mm/dd/yyyy' and nothing before October 2013 (twitter restriction).\n    to_date='12/31/2016'\n)\n\nreports_filepath = reports.run()            # list of filepaths of downloaded csv reports\n\n# Then you can parse the csv simply as follow\ntweets = list()\nfor report in reports_filepath:\n    with open(report, 'r') as csvfile:\n        r = csv.DictReader(csvfile)\n        rows = [row for row in r]\n        tweets += rows\n\n```\n\nIf you encounter issues, submit it on this repo. I also accept pull requests.\n\n## Mac OS install prerequisites\n\n- xvfb: Install XQuartz. Download the installer from [here](https://www.xquartz.org).\n- Chromedriver: The easiest way to obtain this is via [Homebrew](https://brew.sh):\n\n    ```commandline\n    $ /usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"\n    \n    $ brew tap homebrew/cask\n    $ brew cask install chromedriver\n    ```\n    \n\nPlease note that `chromedriver`  was migrated from `homebrew/core` to `homebrew/cask`.\n\n# If you are installing from this repository:\n\n1. Clone/Download (and unzip) this repo in a known location in your computer\n\n2. Open a terminal and navigate to the location chosen for step 1\n\n3. In the terminal type the following\n\n   ```\n   python setup.py install --force\n   ```\n\n   ​","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippe2803%2Ftwitter-analytics-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilippe2803%2Ftwitter-analytics-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilippe2803%2Ftwitter-analytics-wrapper/lists"}