qwant_api 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 58

qwant-api-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 #

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.

0.1.1 #

  • Improve documentation

0.1.0 #

  • Initial version, created by Zemoa
  • Include following search type
    • Web
    • News
    • Videos
    • Images
    • Social

example/qwant_api_example.dart

import 'package:qwant_api/qwant_api.dart';

void main() async {
  var qwantApit = QwantApi();
  var result1 = await qwantApit.searchWeb('test');
  print(result1.status);
  var result2 = await qwantApit.searchWeb('test', count: 2, language: Language.ENGLISH);
  print(result2.status);
  var result3 = await qwantApit.searchNews('test');
  print(result3.status);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  qwant_api: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:qwant_api/qwant_api.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
16
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:qwant_api/qwant_api.dartpackage:qwant_api/src/qwant_api_base.dartdart:io

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:qwant_api/qwant_api.dartpackage:qwant_api/src/qwant_api_base.dartdart:io

Health issues and suggestions

Document public APIs. (-0.38 points)

418 out of 427 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0