Exemplo n.º 1
0
func GetXmlContent(Source string, Categories []string, Thumb string, Title string) []*models.VideoModel {

	var videoList []*models.VideoModel

	var model *models.VideoModel

	model = new(models.VideoModel)
	model.Image = Thumb
	model.Location = Source
	model.Title = Title
	model.Categories = Categories
	videoList = append(videoList, model)

	return videoList
}
Exemplo n.º 2
0
func GetXmlContent(Url string, categories []string, Title string, Thumb string) []*models.VideoModel {
	resp, err := http.Get(Url)
	if err != nil {
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	var q Query
	xml.Unmarshal(body, &q)

	var videoList []*models.VideoModel
	for _, video := range q.Tracklist {
		if video.Location != "" {
			var model *models.VideoModel

			model = new(models.VideoModel)
			model.Image = video.Image
			model.Location = video.Location
			model.Title = strings.TrimSpace(video.Title)
			model.Categories = categories
			videoList = append(videoList, model)
		}
	}
	return videoList
}