Skip to main content

Generate ego networks for users from Twitter.

Project description

Tweego

Generate second order ego networks for users from Twitter. Create egocentric graphs with the twitter api. Tweego allows you to resume data collection over multiple sessions.

Usage

Installation

pip install tweego

CLI

tweego [OPTIONS]

Options:
  -fo, --first-order            Flag: Collect first order ego
  -u, --users                   Flag: Collect user data
  -so, --second-order           Flag: Collect second order ego
  -g, --graph                   Flag: Generate graph file
  -d, --dir PATH                Directory to store data
  -k, --keys-file PATH          Location of the api keys JSON file
  -n, --screen-name TEXT        The screen name of the ego center user
  -f, --follower-limit INTEGER  Number of followers for the second order ego
  --version                     Show the version and exit.
  --help                        Show this message and exit.

Example

Collect everything:

tweego -d "dataset" -k "keys.json" -n "github" --fo --u --so -g

Collect first order connections only:

tweego -d "dataset" -k "keys.json" -n "github" --fo

Collect users and second order connections only:

tweego -d "dataset" -k "keys.json" -n "github" --u --so

API keys format

Tweego supports multiple api keys to speed up the data collection process. The api keys should be in a JSON file with the following format.

You can get these details from the Twitter developer website by creating a standalone app and then generating the keys and tokens.

[
    ...
    {
        "app_key": "<<app_key>>",
        "app_secret": "<<app_secret>>",
        "oauth_token": "<<oauth_token>>",
        "oauth_token_secret": "<<oauth_token_secret>>"
    },
    {
        "app_key": "<<app_key>>",
        "app_secret": "<<app_secret>>",
        "oauth_token": "<<oauth_token>>",
        "oauth_token_secret": "<<oauth_token_secret>>"
    },
    ...
]

Folder Structure

Once Tweego is done, the folder structure should look like this:

dir
├── users
│   ├── user_id_1.json
│   ├── user_id_2.json
│   └── ...
├── screen_name
│   ├── user_id_1
│   |   └── user_id_1.txt
│   ├── user_id_2
│   |   └── user_id_2.txt
│   └── ...
├── screen_name.txt
└── screen_name.gml

The users directory contains information about each user, the screen_name directory contains the follower ids of users. The screen_name.gml file contains the ego network and an application like Gephi can be used to analyze it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tweego-1.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tweego-1.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file tweego-1.1.0.tar.gz.

File metadata

  • Download URL: tweego-1.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for tweego-1.1.0.tar.gz
Algorithm Hash digest
SHA256 734f7e1e675a18bacc4d3b3653b1296e8ef7feb36bb34acc50fd2d7190c91e04
MD5 74f73db21451e236ae985a4c0c00297f
BLAKE2b-256 0809538193d8a7f7ba779cb4581cc91748e5d1eb4797d69d31804e06f3e4c42f

See more details on using hashes here.

File details

Details for the file tweego-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tweego-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for tweego-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac43950b3a7668888fc1f213b05ec1ddf8e3b64f594bae25eab11b6c939fe7b1
MD5 3aeffa65b565c120247ffa32781877a9
BLAKE2b-256 c64eaed6db0dfede2bc98741ed275ee7053110db99410833e4d01289ed25273f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page