Skip to content

Instantly share code, notes, and snippets.

@jz5
Last active December 17, 2015 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jz5/f3d88cc7893a21fe5d48 to your computer and use it in GitHub Desktop.
Save jz5/f3d88cc7893a21fe5d48 to your computer and use it in GitHub Desktop.
Private Function CreateFeed(offset As Integer, count As Integer) As String
' ダミーデータ作成
Dim channelPubDate = Now
Dim items = New List(Of ComicItem)
For i = offset + 1 To count
Dim item = New ComicItem With {
.Title = "タイトル" & i.ToString,
.PubDate = Now.AddDays(count - i),
.ModifiedDate = Now.AddDays(count - i),
.Link = "http://pronama.jp/?" & i.ToString,
.Id = i.ToString,
.Volume = i,
.IsAvailable = True,
.MediaUrl = "http://pronama.jp/?media" & i.ToString,
.ThumbnailUrl = "http://pronama.jp/?thumbnail" & i.ToString,
.Creator = "Creator",
.Guid = "http://pronama.jp/?" & i.ToString}
items.Add(item)
Next
' XDocument 作成
Dim xml =
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcndl="http://ndl.go.jp/dcndl/terms/"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:p="http://pinga.mu/terms/"
>
<channel>
<title>すぱこー</title>
<link>http://pronama.azurewebsites.net/tag/spaco/</link>
<description>高校生の暮井 慧(プロ生ちゃん)と、部活「情報処理研究会」のメンバー 戸増千由莉とフィネス・ヒルヴィレッジが活躍する Web 4コマ漫画「すぱこー」!</description>
<pubDate><%= channelPubDate.ToString("r") %></pubDate>
<image>http://pronama.azurewebsites.net/wp-content/uploads/2015/05/spaco_banner.png</image>
<dc:creator>池村ヒロイチ/プログラミング生放送</dc:creator>
<%= From i In items
Select <item>
<title><%= i.Title %></title>
<dc:creator><%= i.Creator %></dc:creator>
<link><%= i.Link %></link>
<pubDate><%= i.PubDate.ToString("r") %></pubDate>
<description><%= i.Description %></description>
<dcndl:volume><%= i.Volume %></dcndl:volume>
<dc:modified><%= i.ModifiedDate.ToString("s") %></dc:modified>
<p:isAvailable><%= If(i.IsAvailable, "true", "false") %></p:isAvailable>
<media:content url=<%= i.MediaUrl %>></media:content>
<media:thumbnail url=<%= i.ThumbnailUrl %>></media:thumbnail>
<guid isPermaLink="false"><%= i.Guid %></guid>
</item>
%>
</channel>
</rss>
' XML 文字列を返す
Return xml.ToString
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment