Skip to main content

PyCooRnet

Using Python Given a set of URLs, this packages detects coordinated link sharing behavior on social media and outputs the network of entities that performed such behaviour.

pip: https://pypi.org/project/pycoornet/

Project: https://upb-ss1.github.io/

based on https://github.com/fabiogiglietto/CooRnet

Overview

Given a set of URLs, this package detects coordinated link sharing behavior (CLSB) and outputs the network of entities that performed such behavior.

What do we mean by coordinated link sharing behavior?

CLSB refers to a specific coordinated activity performed by a network of Facebook pages, groups and verified public profiles (Facebook public entities) that repeatedly shared the same news articles in a very short time from each other.

To identify such networks, we designed, implemented and tested an algorithm that detects sets of Facebook public entities which performed CLSB by (1) estimating a time threshold that identifies URLs shares performed by multiple distinguished entities within an unusually short period of time (as compared to the entire dataset), and (2) grouping the entities that repeatedly shared the same news story within this coordination interval. The rationale is that, while it may be common that several entities share the same URLs, it is unlikely, unless a consistent coordination exists, that this occurs within the time threshold and repeatedly.

Installation

https://pypi.org/project/pycoornet/

pip install pycoornet

Jupyter Notebook Example

pycoonet_example.ipynb

Usage example

from pycoornet.crowdtangle import CrowdTangle
from pycoornet.shared import Shared
from pycoornet.statistics import Statistics
import networkx as nx
import numpy as np
import pandas as pd
import logging


def main():
    links_df = pd.read_csv('samples/sample_source_links.csv')
    # Init CrowdTangle with api key
    crowd_tangle = CrowdTangle("abc123def345")
    ct_df = crowd_tangle.get_shares(urls=links_df, url_column='clean_url',
                                    date_column='date',clean_urls=True,
                                    platforms='facebook', max_calls = 2)

    shared = Shared(ct_df)
    crowtangle_shares_df, shares_graph, q, coordination_interval = shared.coord_shares(clean_urls=True)

    print(f"Coordination Time = {coordination_interval}")

    #Build Gephi File
    for node in shares_graph.nodes(data=True):
        node[1]['label']=node[1]['account_name']
    nx.write_gexf(shares_graph, "samples/out/shares.gexf")

    componet_summary_df = Statistics.component_summary(crowtangle_shares_df, shares_graph)
    top_urls_df = Statistics.get_top_coord_urls(crowtangle_shares_df, shares_graph)


if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO, filename="pycoornet.log")
    main()

running tests

py.test --crowdtoken=<your crowdtangle api token>

For Example

py.test --crowdtoken=akZbRIg2DNKhFogkN6rFurv

Acknowledgements

CooRnet has been developed as part of the project Social Media Behaviour research project activities.

The project is supported by a the Social Media and Democracy Research Grants from Social Science Research Council (SSRC). Data and tools provided by Facebook.

Metadata

Release files for pycoornet 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycoornet 0.6.0
File Size Uploaded
pycoornet-0.6.0.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycoornet 0.6.0
File Interpreter ABI Platform
pycoornet-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.0 kB

Release files / pycoornet-0.6.0.tar.gz

Download URL pycoornet-0.6.0.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2726ab6c7c7d946f0d49543d940bace9e44e7f19af922f7547a89b3f1be9df64
BLAKE2b-256 checksum
How to use checksums
625a837277de83444a7a080f3aed3493ab1950d4662314da5b319c6de9d333e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / pycoornet-0.6.0-py3-none-any.whl

Download URL pycoornet-0.6.0-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f45af2e0f6bb4adff31e8f44ba6f4066712925693c6e4425c42fe4d9ff79548
BLAKE2b-256 checksum
How to use checksums
c8dfe5c884da677b1c2b4856dd33ab91c7adf2d80889670336ea4f3d44615114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page