<commit_before>// http://www.w3schools.com/rss/default.asp
// http://www.tutorialspoint.com/rss/what-is-atom.htm
package mylib

import (
	"net/http"
	"io/ioutil"
	"encoding/xml"
	"html/template"
)


// http://www.w3schools.com/rss/rss_syntax.asp
type Rss2 struct {
	XMLName	xml.Name	`xml:"rss"`
	Version	string		`xml:"version,attr"`
	Channel	RssChan
}

// http://www.w3schools.com/rss/rss_channel.asp
type RssChan struct {
	XMLName		xml.Name	`xml:"channel"`
	Title		string		`xml:"title"`
	Link		string		`xml:"link"`
	Description	string		`xml:"description"`
	PubDate		string		`xml:"pubDate"`
	ItemList	[]Item		`xml:"item"`
}

// http://www.w3schools.com/rss/rss_item.asp
type Item struct {
	Title		string		`xml:"title"`
	Link		string		`xml:"link"`
	Comments	string		`xml:"comments"`
	Description	template.HTML	`xml:"description"`
	PubDate		string		`xml:"pubDate"`
	IsRead		bool
	ReadDatetime	string
}


func parseSeedContent(content []byte) Rss2 {
	v := Rss2{}
	xml.Unmarshal(content, &v)
	return v
}

func GetSeed(url string) Rss2 {
	resp, err := http.Get(url)
	if err != nil { panic(err) }
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil { panic(err) }
	return parseSeedContent(body)
}
<commit_msg>more code comments<commit_after>// http://www.w3schools.com/rss/default.asp
// http://www.tutorialspoint.com/rss/what-is-atom.htm
package mylib

import (
	"net/http"
	"io/ioutil"
	"encoding/xml"
	"html/template"
)


// http://www.w3schools.com/rss/rss_syntax.asp
type Rss2 struct {
	XMLName	xml.Name	`xml:"rss"`
	Version	string		`xml:"version,attr"`
	Channel	RssChan
}

// http://www.w3schools.com/rss/rss_channel.asp
type RssChan struct {
	XMLName		xml.Name	`xml:"channel"`
	// Required
	Title		string		`xml:"title"`
	Link		string		`xml:"link"`
	Description	string		`xml:"description"`
	// Optional
	PubDate		string		`xml:"pubDate"`
	ItemList	[]Item		`xml:"item"`
}

// http://www.w3schools.com/rss/rss_item.asp
type Item struct {
	// Required
	Title		string		`xml:"title"`
	Link		string		`xml:"link"`
	Description	template.HTML	`xml:"description"`
	// Optional
	PubDate		string		`xml:"pubDate"`
	Comments	string		`xml:"comments"`
	// for reader only
	IsRead		bool
	ReadDatetime	string
}


func parseSeedContent(content []byte) Rss2 {
	v := Rss2{}
	xml.Unmarshal(content, &v)
	return v
}

func GetSeed(url string) Rss2 {
	resp, err := http.Get(url)
	if err != nil { panic(err) }
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil { panic(err) }
	return parseSeedContent(body)
}

{'fraction_non_alphanumeric': 0.15820543093270367, 'fraction_numerical': 0.006296733569460842, 'mean_word_length': 3.984313725490196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 34}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3797118', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1028, 'n_words': 207}