parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HOST_HACKERNEWS = "news.ycombinator.com"
	HOST_YOUTUBE    = "www.youtube.com"
)
View Source
const BaseUrl = "https://readability.theboys.tech/api/parser?url="

Variables

View Source
var InvalidURLError = errors.New("Inavlid url")

Functions

This section is empty.

Types

type Content

type Content struct {
	Title         string `json:"title"`
	Content       string `json:"content"`
	Author        string `json:"author"`
	DatePublished string `json:"date_published"`
	LeadImageURL  string `json:"lead_image_url"`
	Dek           string `json:"dek"`
	NextPageURL   string `json:"next_page_url"`
	URL           string `json:"url"`
	Domain        string `json:"domain"`
	Excerpt       string `json:"excerpt"`
	WordCount     int    `json:"word_count"`
	Direction     string `json:"direction"`
	TotalPages    int    `json:"total_pages"`
	RenderedPages int    `json:"rendered_pages"`
}

Content is the content of a url https://github.com/postlight/parser

{
  "title": "Thunder (mascot)",
  "content": "... <p><b>Thunder</b> is the <a href=\"https://en.wikipedia.org/wiki/Stage_name\">stage name</a> for the...",
  "author": "Wikipedia Contributors",
  "date_published": "2016-09-16T20:56:00.000Z",
  "lead_image_url": null,
  "dek": null,
  "next_page_url": null,
  "url": "https://en.wikipedia.org/wiki/Thunder_(mascot)",
  "domain": "en.wikipedia.org",
  "excerpt": "Thunder Thunder is the stage name for the horse who is the official live animal mascot for the Denver Broncos",
  "word_count": 4677,
  "direction": "ltr",
  "total_pages": 1,
  "rendered_pages": 1
}

type DefaultParser

type DefaultParser struct{}

func New

func New() *DefaultParser

func (*DefaultParser) Parse

func (p *DefaultParser) Parse(urlStr string) (Content, error)

type HackerNewsParser

type HackerNewsParser struct{}

func (HackerNewsParser) Parse

func (p HackerNewsParser) Parse(uri string) (Content, error)

type Parser

type Parser interface {
	Parse(url string) (Content, error)
}

type SubTitleParser added in v0.0.15

type SubTitleParser struct {
	Title       string `json:"title"`
	Duration    string `json:"duration"`
	DurationRaw string `json:"duration_raw"`
	Uploader    string `json:"uploader"`
	Thumbnail   string `json:"thumbnail"`
	Type        string `json:"type"`
	Request     struct {
		Url    string `json:"url"`
		Hash   string `json:"hash"`
		Domain string `json:"domain"`
	} `json:"request"`
	Formats []struct {
		Quality string `json:"quality"`
		Url     string `json:"url"`
		Code    string `json:"code"`
		Ext     string `json:"ext"`
	} `json:"formats"`
}

type YoutubeParser added in v0.0.15

type YoutubeParser struct{}

func (YoutubeParser) Parse added in v0.0.15

func (p YoutubeParser) Parse(uri string) (Content, error)

Jump to

Keyboard shortcuts

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