Package: smat-cli
SMAT-CLIProvides command line tools for getting data from the Social Media Analysis Toolkit (SMAT)
as well as a library for interacting with SMAT from your own code.TheSocial Media Analysis Toolkitis a resource that allows activists, journalists,
researchers, and other social good organizations to collect information about hate, mis/disinformation, and extremism
from a variety of online platforms. The folks at SMAT are providing an amazing service and deserve your support! Go to
theirOpen Collectivepage to support them if you're able.SMAT-CLI is a tool that makes getting that information from the API easy, either from your terminal or as part of your
own application.InstallationOS X & Linux:pipinstallsmat-cliThough, I recommend usingPipxto install it as a a system tool.pipxinstallsmat-cliWindows:Coming soon!Usage ExamplesLet's say you want to collect 1000 posts from Telegram posted between Jan 6 to March 1, 2021. You can do that with thecontentcommand like this.smatcontent-stelegram-l1000--since2021-01-06--until2021-03-01trumpIf you want some aggregated data, you can use thetimeseriescommand to fetch a count of posts mentioning Trump from
Jan 6 to March 1, 2021 and aggregate those into daily buckets, you can use the following.smattimeseries-stelegram-iday--since2021-01-06--until2021-03-01trumpYou can also aggregate by any arbitrary key present in the data for the site. To get an idea of which keys are available,
you can examine the results of acontentcommand. Once you know the key you want to aggregate on, you can useactivityto, for example, count the number of posts containing the term Trump in each Telegram channel from Jan 6 to March 1, 2022.smatactivity-stelegram-achannelusername--since2021-01-06--until2021-03-01trumpAll above commands print output line-by-line to stdout in JSON, so you can pipe the results to a file in the normal way.smatcontent-stelegram-l1000--since2021-01-06--until2021-03-01trump>>data.ndjsonYou can also specify different formats for the output. For example, if you'd like the results in JSON instead of
JSONlines, you can pass--format json. This is currently the only way to format changepoint data when usingtimeseries.smat--formatjsoncontent-stelegram-l1000--since2021-01-06--until2021-03-01trump>data.jsonIn addition, this package can be used in another application by importingSmatfromsmat_cliand using it to query
the API from inside your program.fromsmat_cliimportSmatapi=Smat()data=api.content(term="trump",site="telegram",...)fordindata:print(d["message"])Development SetupThis project usesPoetryand the code is formatted withBlack.Tests can be run viaTox, which will run the tests in Python verions: 3.7, 3.8, 3.9, 3.10.
For this to work properly, all of these Python versions must be installed. A Dockerfile has been included in thetest_runnerdirectory if necessary.poetryinstall
toxRelease History0.1.3Add new sites: TikTok, Rutube, Truth Social (@benzonip)Added support for Python 3.110.1.2Updates to package info and READMEAdd formatters and JsonFormatter0.1.1Updates to package info and README0.1.0Initial releaseMeDaniel Hosterman –@dhosterman–daniel@danielhosterman.comDistributed under theUnlicenselicense. SeeLICENSEfor more information.https://gitlab.com/dhostermanContributingFork it (https://github.com/yourname/yourproject/fork)Create your feature branch (git checkout -b feature/fooBar)Format your code withBlackEnsure there are tests for your changes and that they passCommit your changes (git commit -am 'Add some fooBar')Push to the branch (git push origin feature/fooBar)Create a new Pull RequestContributorsPeter Benzoni (@benzonip)