npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@doridian/furaffinity-api

v4.5.2

Published

FurAffinity wrapper for Node.js

Downloads

2

Readme

重要提示: 本项目适用于 Furaffinity 的 现代 风格.

安装

npm install furaffinity-api

APIs

从 4.1.0 开始,你可以通过 lowerCase 来调用任意 API。 (例如,const {login, search} form "furaffinity-api";

Login(a: string, b: string)

使用 cookie 登录 furaffinity

import { Login } from "furaffinity-api";
// or
const { Login } = require("furaffinity-api");

// to allow all results to be accessible, add your cookies
Login("cookie_a", "cookie_b");

Search(query: string, options: SearchOptions)

搜索作品

import { Search, Type } from 'furaffinity-api';

Search('search query', { /** SearchOptions */ type?, rating?, page? }).then(res => {
  // 结果
  res[0].getSubmission().then(submission => {
    // 作品详情
  });
});

Browse(options?: BrowseOptions)

获取浏览页作品

import { Browse } from "furaffinity-api";

Browse({
  /** BrowseOptions */
}).then((res) => {
  // 结果
  res[0].getSubmission().then((submission) => {
    // 作品详情
  });
});

Submission(id: string)

获取特定的作品

import { Submission } from "furaffinity-api";

Submission("1234567890").then((res) => {
  // res is a Submission
});

User()

获取当前用户信息

import { User } from "furaffinity-api";

User().then((user) => {
  // console.log(user);
});

Author(id: string)

获取某个作者的用户信息

import { Author, WatchingList } from "furaffinity-api";

Author("user_id").then((res) => {
  // 某作者信息
  // 包含 id, name, url and avatar(可能为 undefined)
  WatchingList(res.id).then((list) => {
    // 查询该作者的关注列表
  });
});

Gallery(id: string)

获取某用户的画廊

import { Gallery } from "furaffinity-api";

Gallery("author_id").then((res) => {
  // 结果
  res[0].getSubmission().then((submission) => {
    // 作品详情
  });
});

Scraps(id: string)

获取某用户废弃作品

import { Scraps } from "furaffinity-api";

Scraps("author_id").then((res) => {
  // 结果
  res[0].getSubmission().then((submission) => {
    // 作品详情
  });
});

Submissions()

根据时间线,获取作品详情

import { Submissions } from "furaffinity-api";

Submissions().then((res) => {
  // 结果
  res[0].getSubmission().then((submission) => {
    // 某条作品详情
  });
});

WatchingList(id: string)

获取某用户的关注列表(暂不能获取头像)

import { WatchingList } from "furaffinity-api";

WatchingList("author_id").then((list) => {
  // 作者列表
});

MyWatchingList()

Login first 获取当前登录用户的关注列表(暂不能获取头像)

import { MyWatchingList } from "furaffinity-api";

MyWatchingList().then((list) => {
  // 作者列表
});

removeFromInbox()

Login first 从时间线中移除作品:

import { removeFromInbox } from "furaffinity-api";

removeFromInbox(['viewId', 'viewId']);

watchAuthor()

Login first 关注一个用户,如果已关注则无效果:

import { watchAuthor } from "furaffinity-api";

watchAuthor('userId');

unwatchAuthor()

Login first 取消关注一个用户,如果未关注则无效果:

import { unwatchAuthor } from "furaffinity-api";

unwatchAuthor('userId');

toggleWatch()

Login first 请求 IAuthor 上拿到的 watchLink,用来切换关注状态:

import { toggleWatch } from "furaffinity-api";

toggleWatch('https://www.furaffinity.net/watch/userid/?key=033d7e8f2860f80850557df7ed99120ac9f926e3');

测试

在测试前,先在 /tests/jest.config.ts 中添加配置:

export const options: ITestConfig = {
  loginOptions: {
    cookieA: "your cookie a", // your cookies
    cookieB: "your cookie b"
  },
  watchOptions: {
    userId: "your userid",
    shouldContainUserId: "userid you are watching"
  },
  authorOptions: {
    userId: "your favorite author's userid"
  }
};

接着运行:

npm run test

鸣谢

License

ISC