medium_search
Unofficial search provider for Medium that can be used in dart or flutter apps.
This library provides you an easy way to get search results from Medium website.
It supports searching for:
- posts
- tags
- users
- publications
Insalling
- add to your
pubspec.yaml
:
medium_search: ^0.0.1
- get it
dart pub get
- import it
import 'package:medium_search/medium_search.dart';
- initialize
var medium = Medium();
get tags:
var tags = await medium.getTags("Hello");
for (var tag in tags) {
print("The tag `${tag.name}` has ${tag.postCount} posts.");
}
get posts:
var page = await medium.getPosts("hello");
for (var post in page.posts) {
print("${post.title} => ${post.id}");
}
and you can get the next page by:
var nextPage = await page.nextPage();
or by getting specific page number:
var page = await medium.getPosts("Hello", page: 3); // which returns the 3th page for the query 'Hello'.
get users:
var page = await medium.getUsers("ronaldo");
for (var user in page.users) {
print("${user.name} => ${user.bio}");
}
get publications:
var page = await medium.getPublications("Hello");
for (var public in page.users) {
print("${public.name} => ${public.description}");
}