parsers/youtube: Add NSFW marker for age-restricted videos.

develop
Icedream 2016-07-05 16:18:14 +02:00
parent b61927108b
commit 2608df9727
2 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,13 @@
»
{{- if index . "AgeRestriction" }}
{{ color 4 -}}
{{ bold -}}
[{{- index . "AgeRestriction" }}]
{{- reset }}
{{- end }}
{{ if index . "IsProfile" }}
{{- if index . "Title" }}
{{ bold -}}

View File

@ -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