lestresolver

package module
v0.0.0-...-2a30a82 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 8 Imported by: 0

README

lestresolver

VIDSRC.ME / VIDSRC.NET RESOLVER

A Go package for resolving HLS streaming URLs from IMDb IDs via vidsrc.me / vidsrc.net without ads. Extract direct playback links for movies and TV shows with multiple quality variants.

Features

  • 🎬 Support for both movies and TV shows
  • 🎯 Resolve HLS master playlists from IMDb IDs
  • 📺 Extract multiple quality variants (resolution, bandwidth, direct URLs)
  • ⚡ Simple and straightforward API
  • 🔒 Built-in timeout handling for HTTP requests

Installation

go get github.com/lestwastaken/lestresolver

Dependencies

This package requires:

go get github.com/PuerkitoBio/goquery

Quick Start

Movie Example
package main

import (
    "fmt"
    "log"
    "github.com/lestwastaken/lestresolver"
)

func main() {
    opts := lestresolver.ResolveOptions{
        IMDBID: "tt1300854", // Iron Man 3
        Type:   lestresolver.Movie,
    }

    streams, err := opts.ResolveStreams()
    if err != nil {
        log.Fatalf("failed to resolve: %v", err)
    }

    for _, s := range streams {
        fmt.Printf("Resolution: %s | Bandwidth: %s\n", s.Resolution, s.Bandwidth)
        fmt.Printf("URL: %s\n\n", s.URL)
    }
}
TV Show Example
package main

import (
    "fmt"
    "log"
    "github.com/lestwastaken/lestresolver"
)

func main() {
    opts := lestresolver.ResolveOptions{
        IMDBID:  "tt0944947", // Game of Thrones
        Type:    lestresolver.TV,
        Season:  1,
        Episode: 1,
    }

    streams, err := opts.ResolveStreams()
    if err != nil {
        log.Fatalf("failed to resolve: %v", err)
    }

    for _, s := range streams {
        fmt.Printf("Resolution: %s | Bandwidth: %s\n", s.Resolution, s.Bandwidth)
        fmt.Printf("URL: %s\n\n", s.URL)
    }
}

API Reference

Types
MediaType

Represents the type of content to resolve.

const (
    Movie MediaType = "movie"
    TV    MediaType = "tv"
)
ResolveOptions

Configuration for resolving streams.

type ResolveOptions struct {
    IMDBID  string    // IMDb ID (e.g., "tt1300854")
    Type    MediaType // Movie or TV
    Season  int       // Required for TV shows
    Episode int       // Required for TV shows
}
StreamVariant

Represents a single quality variant of a stream.

type StreamVariant struct {
    Resolution string // e.g., "1920x1080"
    Bandwidth  string // e.g., "5000000"
    URL        string // Direct HLS stream URL
}
Methods
ResolveVariants() (string, error)

Returns the HLS master playlist URL.

opts := lestresolver.ResolveOptions{
    IMDBID: "tt1300854",
    Type:   lestresolver.Movie,
}

masterURL, err := opts.ResolveVariants()
if err != nil {
    log.Fatal(err)
}

fmt.Println("Master Playlist URL:", masterURL)
ResolveStreams() ([]StreamVariant, error)

Fetches the master playlist and returns all available stream variants.

opts := lestresolver.ResolveOptions{
    IMDBID: "tt1300854",
    Type:   lestresolver.Movie,
}

streams, err := opts.ResolveStreams()
if err != nil {
    log.Fatal(err)
}

for _, stream := range streams {
    fmt.Printf("%s: %s\n", stream.Resolution, stream.URL)
}

Finding IMDb IDs

IMDb IDs can be found on IMDb.com:

  1. Search for your movie or TV show
  2. The URL will contain the ID: https://www.imdb.com/title/tt1300854/
  3. Use the tt ID (e.g., tt1300854)

Usage with Video Players

The resolved URLs are standard HLS streams and can be used with any HLS-compatible player:

VLC Media Player
vlc "https://example.com/stream.m3u8"
ffplay
ffplay "https://example.com/stream.m3u8"
MPV
mpv "https://example.com/stream.m3u8"

Error Handling

The package returns descriptive errors for common issues:

streams, err := opts.ResolveStreams()
if err != nil {
    switch {
    case strings.Contains(err.Error(), "imdbId is empty"):
        log.Fatal("IMDb ID is required")
    case strings.Contains(err.Error(), "season and episode must be set"):
        log.Fatal("Season and episode required for TV shows")
    case strings.Contains(err.Error(), "unexpected status"):
        log.Fatal("Network error or content unavailable")
    default:
        log.Fatalf("Error: %v", err)
    }
}

Advanced Usage

Getting Only the Master Playlist URL

If you only need the master playlist URL without parsing variants:

opts := lestresolver.ResolveOptions{
    IMDBID: "tt1300854",
    Type:   lestresolver.Movie,
}

masterURL, err := opts.ResolveVariants()
if err != nil {
    log.Fatal(err)
}

// Use masterURL directly
fmt.Println(masterURL)
Selecting a Specific Quality
streams, err := opts.ResolveStreams()
if err != nil {
    log.Fatal(err)
}

// Find highest quality
var best StreamVariant
var maxBandwidth int

for _, s := range streams {
    if bandwidth, _ := strconv.Atoi(s.Bandwidth); bandwidth > maxBandwidth {
        maxBandwidth = bandwidth
        best = s
    }
}

fmt.Printf("Best quality: %s (%s)\n", best.Resolution, best.URL)

Limitations

  • Requires active internet connection
  • HTTP requests have a 10-second timeout
  • Depends on external service availability
  • Some content may be geo-restricted

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

This project is created by lestwastaken.

Disclaimer

This tool is for educational purposes only. Users are responsible for ensuring their use complies with applicable laws and terms of service. The authors are not responsible for any misuse of this software.

Support


Made with ❤️ by lestwastaken

Documentation

Overview

Created by lestwastaken (Discord & Github)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MediaType

type MediaType string

MediaType is the type of content (movie or tv).

const (
	Movie MediaType = "movie"
	TV    MediaType = "tv"
)

type ResolveOptions

type ResolveOptions struct {
	IMDBID  string
	Type    MediaType
	Season  int
	Episode int
}

ResolveOptions contains the input parameters for resolving an HLS stream.

func (ResolveOptions) ResolveStreams

func (o ResolveOptions) ResolveStreams() ([]StreamVariant, error)

ResolveStreams fetches the master playlist and extracts all variant streams.

func (ResolveOptions) ResolveVariants

func (o ResolveOptions) ResolveVariants() (string, error)

ResolveVariants runs the full resolution pipeline and returns the final HLS master URL.

type StreamVariant

type StreamVariant struct {
	Resolution string
	Bandwidth  string
	URL        string
}

StreamVariant represents one HLS variant (quality level).

Directories

Path Synopsis
Example usage of lestresolver
Example usage of lestresolver

Jump to

Keyboard shortcuts

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