GithubHelp home page GithubHelp logo

nelsonminar / trending-statuses Goto Github PK

View Code? Open in Web Editor NEW

This project forked from feditrends/trending-statuses

0.0 1.0 0.0 110 KB

a filterable feed of statuses trending across the fediverse

License: MIT License

Python 39.59% HTML 60.41%

trending-statuses's Introduction

Trending Statuses

This app will fetch trending statuses from a specified list of Mastodon instances, write them to a SQLite database in an aggregated, full-text search index, then expose a simple REST API that serves the statuses back in JSON. A sample user interface written in HTML/CSS/JS is provided for interacting with the API.

How to install & run

This has been tested on Python 3.10.6 but not extensively on other versions. Your mileage may vary.

1. Install dependencies

pip3 install -r requirements.txt

2. Configure instance list

(Optional) Configure the instances you wish to process trends from in instances.txt. One instance per line, and just the hostname without protocol, eg. "mastodon.social". Usually, the bigger and more federated the instances, the better. The more you add, the longer processing will take however. Around 10-15 big instances works well. The file in this repo already includes default instances, and you can leave this as-is if you'd like. There is a lot of overlap across instances, but the processing step will handle consolidating that.

3. Run a snapshot

Run your first snapshot:

python3 process.py

This will boostrap the database and run an initial snapshot across the instances specified in instances.txt. The results will then be consolidated down and inserted into a full-text search indexed table which the API uses.

In production, you'll want to periodically re-run process.py so that your database stays up-to-date. Running it every 15 minutes using cron seems to work well.

4. Run API server:

Run the local development server using Flask:

flask --app server run

You can then navigate to the URL returned in your terminal (eg. http://127.0.0.1:5000/). The API results will be rendered at the /api endpoint and you can view the sample user interface pointing at the API at /static/statuses.html

In production, you'll want to put this Flask app behind a WSGI server such as Gunicorn or Waitress. For more details, visit the Flask docs.

The MIT License (MIT)

Copyright (c) 2022 feditrends

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

trending-statuses's People

Contributors

ummjackson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.