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.
Project description
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
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pycoornet-0.6.0.tar.gz
.
File metadata
- Download URL: pycoornet-0.6.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2726ab6c7c7d946f0d49543d940bace9e44e7f19af922f7547a89b3f1be9df64 |
|
MD5 | 7a31384f8fc4da6ac6a79c53cbf0150b |
|
BLAKE2b-256 | 625a837277de83444a7a080f3aed3493ab1950d4662314da5b319c6de9d333e1 |
File details
Details for the file pycoornet-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: pycoornet-0.6.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f45af2e0f6bb4adff31e8f44ba6f4066712925693c6e4425c42fe4d9ff79548 |
|
MD5 | 3157f0026359164dbc9ce7f2ef77a8a6 |
|
BLAKE2b-256 | c8dfe5c884da677b1c2b4856dd33ab91c7adf2d80889670336ea4f3d44615114 |