zemoa / qwant-api-dart

Helper for using qwant api in dart language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 https://github.com/NLDev/qwant-api . Created from templates made available by Stagehand under a BSD-style

license

Installation

Check on https://pub.dev/

#pubspec.yaml
dependencies:
    qwant_api: ^0.1.1

Import :

import 'package:qwant_api/qwant_api.dart';

Features

Supported search

WEB NEWS IMAGES VIDEOS SOCIAL MUSIC
included included included included included not included
qwantApi.searchWeb qwantApi.searchNews qwantApi.searchImages qwantApi.searchVideos qwantApi.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 Type Result's type
WEB QWWebResult
NEWS QWNewsResult
IMAGES QWImageResult
VIDEOS QWVideoResult
SOCIAL QWSocialResult

Available options for each search

Parameter Required Type Description
query Yes String Words to search
count No int Number of items to search (currently it seems to be limited to 50 by Qwant's API)
offset No int Index of the first items to fetch (for pagination)
language No Language Language 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.

About

Helper for using qwant api in dart language

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dart 100.0%