Git Product home page Git Product logo

pixiv_dart's Introduction

pixiv.dart

pixivAPIをDart/Flutterで利用するためのパッケージです。

Features

TODO: List what your package can do. Maybe include images, gifs, or videos.

Getting started

Install

このパッケージは開発中であり、長期的なサポートを想定していないため、pub.devでは公開していません。そのため、パッケージを使用するためにはpubspec.yamldependenciesに以下の記述を追加する必要があります。

dependencies:
  pixiv_dart:
    git:
      url: https://github.com/MnyaCat/pixiv_dart
      ref: # バージョンを固定するコミットのハッシュ値を書いてください(例: 0ff847f)。

Retrieving Auth Token

pixivへログインするためには、OAuth認証のアクセストークンを取得する必要があります。
以下の手順に従って、アクセストークンを取得してください。

  1. oauth_flow.dartを実行します。
  2. 表示されたリンクをブラウザで開きます。
  3. DevToolsを開き(Google Chromeの場合はF12)、"Network(ネットワーク)"タブに移動します。
  4. "Preserve log(ログを保持)"を有効にし、"Filter"にcallback?を入力します。
  5. pixivへログインしてください。
  6. ログインすると、https://app-api.pixiv.net/web/v1/users/auth/pixiv/callback?state=...&code=...のようなリクエストが表示されます。codeパラメーターの値をコピーして、コンソールにペーストし、Enterを押してください。

アクセストークンの取得に成功すると、コンソールへ取得したトークンが出力されます。
アカウント情報をファイルに保存する場合は、引数--save-accountを付けて実行してください。カレントディレクトリ配下のuser_account.jsonに出力されます。
ここで取得したトークンを利用することで、アカウントにログインできます。誤ってインターネット上にアップロードしないように気をつけてください。

Usage

import 'package:http/http.dart' show Client;
import 'package:pixiv_dart/pixiv_dart.dart';

void main() async {
  final api =
      await ApiClient.loginWithRefreshToken('your refresh token', Client());

  // fetch illust detail
  final illust = await api.fetchIllustDetail(92210213);
  print('title: ${illust.title}');
}

LICENSE

Copyright (c) 2023 MnyaCat
Released under the MIT license
see LICENSE file

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.