duoinfo

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 2 Imported by: 0

README

duoinfo

A Go library to fetch public Duolingo profile data via Duolingo's REST API.

CI Go Reference Go Version


Overview

duoinfo gives you a clean Go API over Duolingo's public users endpoint to pull profile, course, streak, and XP data without dealing with request building or response parsing yourself.

Function What it returns
GetUser Full profile: courses, streak data, total XP, and XP by language

Installation

go get github.com/reinanbr/duoinfo

Requirements: Go 1.21+ · Internet access to Duolingo's public API (no auth token required)


Quick Start

package main

import (
    "fmt"

    "github.com/reinanbr/duoinfo"
)

func main() {
    user, err := duoinfo.GetUser("reinanbr")
    if err != nil {
        fmt.Println("error:", err)
        return
    }

    fmt.Println("name:", user.Name)
    fmt.Println("total xp:", user.TotalXP)
    fmt.Println("streak:", user.Streak)

    for _, xp := range user.XPByLanguage {
        fmt.Printf("%s: %.1f%%\n", xp.LanguageID, xp.Percentage)
    }
}

API Reference

GetUser(username string) (User, error)

Returns the full Duolingo profile for username.

type User struct {
    Username     string
    Name         string
    FirstName    string
    LastName     string
    Bio          string
    Picture      string
    CreationDate int64
    Streak       int
    TotalXP      int
    Courses      []Course
    StreakData   StreakData
    XPByLanguage []LanguageXP
}

XPByLanguage is derived client-side: each course's share of the user's total XP, sorted from highest to lowest.


Contributing

Contributions are welcome! See CONTRIBUTING.md for how to set up the project, run tests, and submit a pull request.


License

MIT — see LICENSE.

Documentation

Overview

Package duoinfo provides a Go client for public Duolingo profile data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Course

type Course = utils.Course

type LanguageXP

type LanguageXP = utils.LanguageXP

type Streak

type Streak = utils.Streak

type StreakData

type StreakData = utils.StreakData

type User

type User = utils.User

func GetUser

func GetUser(username string) (User, error)

GetUser fetches the public Duolingo profile for username: courses, streak data, total XP, and XP broken down by language/course.

Directories

Path Synopsis
examples
user command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL