parsers/youtube: Add NSFW marker for age-restricted videos.
parent
b61927108b
commit
2608df9727
7
main.tpl
7
main.tpl
|
@ -25,6 +25,13 @@
|
|||
|
||||
»
|
||||
|
||||
{{- if index . "AgeRestriction" }}
|
||||
{{ color 4 -}}
|
||||
{{ bold -}}
|
||||
[{{- index . "AgeRestriction" }}]
|
||||
{{- reset }}
|
||||
{{- end }}
|
||||
|
||||
{{ if index . "IsProfile" }}
|
||||
{{- if index . "Title" }}
|
||||
{{ bold -}}
|
||||
|
|
|
@ -168,6 +168,12 @@ func (p *Parser) Parse(u *url.URL, referer *url.URL) (result parsers.ParseResult
|
|||
} else {
|
||||
log.Print(err)
|
||||
}
|
||||
|
||||
if item.ContentDetails.ContentRating != nil {
|
||||
if item.ContentDetails.ContentRating.YtRating == "ytAgeRestricted" {
|
||||
r["AgeRestriction"] = "NSFW"
|
||||
}
|
||||
}
|
||||
}
|
||||
if item.Statistics != nil {
|
||||
r["Views"] = item.Statistics.ViewCount
|
||||
|
|
Loading…
Reference in New Issue