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

letterboxd-api

v1.0.2

Published

get public diary data for letterboxd users

Downloads

6

Readme

letterboxd-api

npm

get public data for letterboxd users

currently only consumes the RSS feeds from letterboxd, when API is released this will be used

This project is not affiliated with letterboxd

It's also a fork of letterboxd by zaccolley with added support for typescript

Much love for the original author <3

installation

npm install letterboxd-api

Usage

function(username, [callback])

Returns a promise if no callback is provided.

import letterboxd from "letterboxd-api";

letterboxd("zeromero")
  .then((items) => console.log(items))
  .catch((error) => console.log(error));

Example using typescript

import letterboxd from "../index";
import type { Letterboxd } from "../src/letterboxd";

letterboxd("zeromero")
  .then((items) => logItems(items))
  .catch((error) => console.log(error));

function logItems(items: Letterboxd[]) {
  const diaryEntries = items.filter((item) => item.type === "diary");
  const lists = items.filter((item) => item.type === "list");

  console.log("");

  console.log(`Diary entries (${diaryEntries.length}):\n`);

  diaryEntries.map((diaryEntry) => {
    if ("film" in diaryEntry) {
      console.log(`  + ${diaryEntry.film.title} (${diaryEntry.uri})\n`);
    }
  });

  console.log(`\nLists (${lists.length}):\n`);

  lists.map((list) => {
    if ("title" in list) {
      console.log(`  + ${list.title} (${list.uri})\n`);
    }
  });

  console.log("");
}

output

output is an array of items.

there are two types of items: diary entries and lists.

due to the limitation of the data source (scraping a RSS feed), only the 20 most recent diary entries are returned

items of note for the list type:

  • ranked: shows if it was set to ranked (1, 2, 3, 4).
  • films: films in the list, capped at 10
  • totalFilms: the total amount of films in the list, only 10 films are given here.
[
  {
    type: "diary",
    film: {
      title: "Zootopia",
      year: "2016",
      image: { tiny: "...", small: "...", medium: "...", large: "..." },
    },
    rating: { text: "★★★★", score: 4 },
    review: "proper cute, funny and interesting through out. ...",
    spoilers: false,
    isRewatch: false,
    date: { watched: 1463702400000, published: 1463784779000 },
    uri: "https://letterboxd.com/zaccolley/film/zootopia/",
  },
  //...
  {
    type: "list",
    date: {
      published: 1473470608000,
    },
    title: "All The Toy Stories",
    description: "I fucking love these films lol",
    ranked: false,
    films: [
      { title: "Toy Story", uri: "https://letterboxd.com/film/toy-story/" },
      { title: "Toy Story 2", uri: "https://letterboxd.com/film/toy-story-2/" },
      { title: "Toy Story 3", uri: "https://letterboxd.com/film/toy-story-3/" },
      {
        title: "Toy Story That Time Forgot",
        uri: "https://letterboxd.com/film/toy-story-that-time-forgot/",
      },
      {
        title: "Toy Story of Terror!",
        uri: "https://letterboxd.com/film/toy-story-of-terror/",
      },
    ],
    totalFilms: 56,
    uri: "https://letterboxd.com/zaccolley/list/tiff-2016/",
  },
  //...
];

types

type Diary = {
  type: "diary";
  date: {
    published: number;
    watched: number;
  };
  film: {
    title: string;
    year?: string;
    image?: ImageSchema;
  };
  rating: {
    text: string;
    score: number;
  };
  review?: string;
  spoilers?: boolean;
  isRewatch?: boolean;
  uri: string;
};

type List = {
  type: "list";
  date: {
    published: number;
  };
  title: string;
  description: string;
  ranked: boolean;
  films: {
    title: string;
    uri: string;
  }[];
  totalFilms: number;
  uri: string;
};

type ImageSchema = {
  tiny?: string;
  small?: string;
  medium?: string;
  large?: string;
};

type Letterboxd = Diary | List;