Merge pull request #53 from VTGare/master
Sensitive content field for tweets
This commit is contained in:
commit
658e55847d
2 changed files with 40 additions and 27 deletions
12
timeline.go
12
timeline.go
|
|
@ -32,6 +32,11 @@ type timeline struct {
|
||||||
Media []struct {
|
Media []struct {
|
||||||
IDStr string `json:"id_str"`
|
IDStr string `json:"id_str"`
|
||||||
MediaURLHttps string `json:"media_url_https"`
|
MediaURLHttps string `json:"media_url_https"`
|
||||||
|
ExtSensitiveMediaWarning struct {
|
||||||
|
AdultContent bool `json:"adult_content"`
|
||||||
|
GraphicViolence bool `json:"graphic_violence"`
|
||||||
|
Other bool `json:"other"`
|
||||||
|
} `json:"ext_sensitive_media_warning"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
VideoInfo struct {
|
VideoInfo struct {
|
||||||
Variants []struct {
|
Variants []struct {
|
||||||
|
|
@ -211,9 +216,16 @@ func (timeline *timeline) parseTweet(id string) *Tweet {
|
||||||
maxBitrate = variant.Bitrate
|
maxBitrate = variant.Bitrate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tw.Videos = append(tw.Videos, video)
|
tw.Videos = append(tw.Videos, video)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !tw.SensitiveContent {
|
||||||
|
sensitive := media.ExtSensitiveMediaWarning
|
||||||
|
tw.SensitiveContent = sensitive.AdultContent || sensitive.GraphicViolence || sensitive.Other
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, url := range tweet.Entities.URLs {
|
for _, url := range tweet.Entities.URLs {
|
||||||
tw.URLs = append(tw.URLs, url.ExpandedURL)
|
tw.URLs = append(tw.URLs, url.ExpandedURL)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
types.go
1
types.go
|
|
@ -35,6 +35,7 @@ type (
|
||||||
UserID string
|
UserID string
|
||||||
Username string
|
Username string
|
||||||
Videos []Video
|
Videos []Video
|
||||||
|
SensitiveContent bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProfileResult of scrapping.
|
// ProfileResult of scrapping.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue