qwant-api-dart

Qwant icon

Unofficial Qwant Api wrapper for Dart.

develop : Build Status master : Build Status


Description

This library is built to help you to make some queries using Qwant's engine.

Inspired by github.com/NLDev/qwant-api . Created from templates made available by Stagehand under a BSD-style

license

Installation

Check on pub.dev/

#pubspec.yaml
dependencies:
    qwant_api: ^0.1.1

Import :

import 'package:qwant_api/qwant_api.dart';

Features

WEBNEWSIMAGESVIDEOSSOCIALMUSIC
includedincludedincludedincludedincludednot included
qwantApi.searchWebqwantApi.searchNewsqwantApi.searchImagesqwantApi.searchVideosqwantApi.searchSocial

Supported languages

enum Language {
    ENGLISH,
    GERMAN,
    FRENCH,
    WELSH,
    SCOTTISH,
    CORSICAN,
    BRETON,
    SPANISH,
    CATALAN,
    BASQUE,
    ITALIAN,
    PORTUGUESE,
    DUTCH,
    RUSSIAN,
    POLISH,
    GREEK,
    FINNISH,
    BULGARIAN,
    JAPANES,
    MALAY,
    HEBREW,
    TURKISH,
    CZECH,
    ESTONIAN,
    HUNGARIAN,
    ROMANIAN,
    DANISH,
    NORWEGIAN,
    SWEDISH,
    KOREAN,
    THAI
}

How to use it

Example


import 'package:qwant_api/qwant_api.dart';

void main() async {
    // Instantiate the api
    var qwantApit = QwantApi();
    // Then perform an async search
    var result1 = await qwantApit.searchWeb('test');
    var result2 = await qwantApit.searchWeb('test', count: 2, language: Language.ENGISH);
}

It will return a value of type QWSearchResult<T extends QWResult> where QWResult could be one of the following types depending on the search:

Search TypeResult's type
WEBQWWebResult
NEWSQWNewsResult
IMAGESQWImageResult
VIDEOSQWVideoResult
SOCIALQWSocialResult
ParameterRequiredTypeDescription
queryYesStringWords to search
countNointNumber of items to search (currently it seems to be limited to 50 by Qwant's API)
offsetNointIndex of the first items to fetch (for pagination)
languageNoLanguageLanguage for the search

Important notes

According to NLDev/qwant-api, there are some limitations. After some queries a captcha should be filled.

I didn't reach this limit so no helper has been provided to catch this behavior yet.

Libraries

qwant_api