drivel/rss.template
2020-10-29 19:33:56 +01:00

44 lines
1.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Home</title>
<link>https://twitter.com</link>
<description>Twitter</description>
{{range $index, $post := .}}
<item>
<title>{{$post.User.Screen_name}} ({{$post.Id_str}})</title>
<content:encoded><![CDATA[
{{$status := $post}}
{{if $status.Retweeted_status}}
{{$status = $post.Retweeted_status}}
{{$post.User.Screen_name}} retweeted
{{end}}
{{$user := $status.User.Screen_name}}
@{{$user}}{{if $status.In_reply_to_status_id_str}} in reply to {{$status.In_reply_to_status_id_str}}{{end}}: <br><br>{{$status.Text}}
{{range $idxMedia, $media := $status.Extended_entities.Media}}
<br><a href="https://twitter.com/{{$user}}/status/{{$status.Id_str}}"><img src="{{$media.Media_url}}"></a>
{{end}}
{{if $status.Quoted_status}}
{{$quotedUser := $status.Quoted_status.User.Screen_name}}
<br><br>Quotes
@{{$quotedUser}}: <br><br>{{$status.Quoted_status.Text}}
{{range $idxMedia, $media := $status.Quoted_status.Extended_entities.Media}}
<br><a href="https://twitter.com/{{$quotedUser}}/status/{{$status.Quoted_status.Id_str}}"><img src="{{$media.Media_url}}"></a>
{{end}}
{{end}}
]]></content:encoded>
<link>https://twitter.com/{{$user}}/status/{{$status.Id_str}}</link>
<guid>https://twitter.com/{{$user}}/status/{{$status.Id_str}}</guid>
<pubDate>{{$post.Created_at.Time.Format "Mon, 02 Jan 2006 15:04:05 -0700"}}</pubDate>
</item>
{{- end}}
</channel>
</rss>