Code Monkey home page Code Monkey logo

twitchqt's Introduction

TwitchQt

The project is discontinued and publicly archived, work has been continued in this fork.

A simple Header-only Qt wrapper for the new Twitch.tv api(Helix) written using Qt5. It also supports TwitchEmotes, BTTV and FFZ.

Requirements

Qt5

  • Core
  • Network

C++11 compatible compiler

Usage

QMake

Clone this library wherever you want and just include(path/to/TwitchQt.pri) in your .pro file.

CMake

include(FetchContent)
...
FetchContent_Declare(
    TwitchQt
    GIT_REPOSITORY "https://github.com/jkbz64/TwitchQt"
    GIT_TAG "commit hash"
    )
FetchContent_MakeAvailable(TwitchQt)

Or clone the repo in your project and add add_subdirectory(path/to/TwitchQt) in your CMakeLists.txt.

Example

#include <QCoreApplication>
#include <TwitchQt/Twitch>

int main(int argc, char* argv[])
{
    QCoreApplication a(argc, argv);
    
    // Twitch::Api is aliased to New Twitch Api (Helix)
    Twitch::Api api("CLIENT-ID HERE");
    api.setBearerToken("BEARER-TOKEN HERE");

    // Note: For this endpoint stream has to be online to return the data! 
    auto reply = api.getStreamByName("forsen");
    a.connect(reply, &Twitch::Reply::finished, [&a, reply]() {
        if (reply->currentState() == Twitch::ReplyState::Success) {
            // Convert reply data to Stream struct
            auto stream = reply->data().value<Twitch::Stream>();
            qDebug() << stream.m_title; // Print title
            qDebug() << stream.m_viewerCount; // Print viewer count as int
            qDebug() << stream.m_startedAt.date(); // Print date
        }
        // Quit program after receiving reply
        a.quit();
    });

    a.exec();

    return 0;
}

Features

Look at the twitchapi.hpp file :)

twitchqt's People

Contributors

g-fb avatar jkbz64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

twitchqt's Issues

Pubsub/eventsub support

Do pubsub and/or eventsub fall under the scope of this?

If so I might be able to hack on this (no promises though, I'll have to learn a lot).

Reconsider using qt json

It seems like the native json support in qt got rewritten to use cbor as a backend, thus eliminating the 127mb limit that was previously cited as a reason for using a 3rd party json lib.

Would you reconsider using qt's native json impl?
Not that this matters, I just think one less non-qt dependency is nice.

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.