n0madic / go-hdrezka

Scraper package for HDrezka site

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-hdrezka

Go Reference

Scraper package for HDrezka site.

Install

go get -u github.com/n0madic/go-hdrezka

Usage example

package main

import (
	"fmt"

	"github.com/n0madic/go-hdrezka"
)

func main() {
	r, err := hdrezka.New("https://hdrezka.ag", "https://rezka.ag")
	if err != nil {
		panic(err)
	}
	// Get list of the new popular series
	opts := hdrezka.CoverOption{
		Filter: hdrezka.FilterPopular,
		Genre:  hdrezka.Series,
		Type:   hdrezka.CoverNew,
	}
	items, err := r.GetCovers(opts, 5)
	if err != nil {
		panic(err)
	}
	// Get first video
	video, err := r.GetVideo(items[0].URL)
	if err != nil {
		panic(err)
	}
	// Print information about video
	fmt.Println(video)
	// Get episodes for first translation
	episodes, err := video.Translation[0].GetEpisodes()
	if err != nil {
		panic(err)
	}
	// Get stream for first season episodes
	season := 1
	for episode := range episodes[season] {
		stream, err := video.Translation[0].GetStream(season, episode)
		if err != nil {
			panic(err)
		}
		// Print stream URL for episode
		fmt.Println(stream.Formats["1080p"].MP4)
	}
}

Fully functional examples can be found in the cmd folder:

  • hdrezka-dl - utility that downloads videos from the HDrezka site
  • hdrezka-rlz - utility for receiving and searching for releases (covers) from the site

About

Scraper package for HDrezka site

License:MIT License


Languages

Language:Go 100.0%