bunp version
This commit is contained in:
parent
d86ca5f7ba
commit
28ead874a3
2 changed files with 19 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
import httpclient
|
import httpclient
|
||||||
import os, strutils, strformat, tables, re, sugar, uri
|
import os, strutils, strformat, tables, re, sugar, uri, times
|
||||||
|
|
||||||
type
|
type
|
||||||
Urls = seq[string]
|
Urls = seq[string]
|
||||||
|
@ -120,7 +120,8 @@ proc compilePage(content: string, video_uri: string = "", search_query: string =
|
||||||
return page
|
return page
|
||||||
|
|
||||||
proc compileRSSPage(content: string, search_query: string = ""): string =
|
proc compileRSSPage(content: string, search_query: string = ""): string =
|
||||||
var rss = RESOURCES["rss_start"]
|
var rss = RESOURCES["rss_start"].replace("Pimvidious",fmt"Pimvidious {search_query}")
|
||||||
|
rss = rss.replace("BUILDDATE", now().format("YYYY-MM-dd'T'HH:mm:ss"))
|
||||||
let urls = parseUrls(content)
|
let urls = parseUrls(content)
|
||||||
let thumbs = parseThumbs(content)
|
let thumbs = parseThumbs(content)
|
||||||
for idx, url in urls:
|
for idx, url in urls:
|
||||||
|
@ -133,7 +134,15 @@ proc compileRSSPage(content: string, search_query: string = ""): string =
|
||||||
vid_url = url.replace("THUMBNUM","1")
|
vid_url = url.replace("THUMBNUM","1")
|
||||||
vid_thumb = thumbs[^1].replace("THUMBNUM","1")
|
vid_thumb = thumbs[^1].replace("THUMBNUM","1")
|
||||||
let title = vid_url.split("/")[^1].replace("_"," ")
|
let title = vid_url.split("/")[^1].replace("_"," ")
|
||||||
rss &= fmt"""<item><title>{title}</titcle><link>{vid_url}</link><description>{title}</description><image><title>{title}</title><url>{vid_thumb}</url></image></item>"""
|
rss &= fmt"""
|
||||||
|
<item>
|
||||||
|
<guid isPermaLink="true">{url}</guid>
|
||||||
|
<title>{title}</title>
|
||||||
|
<link>{vid_url}</link>
|
||||||
|
<description>{title}</description>
|
||||||
|
<media:content url="{vid_thumb}" type="image/png"></media:content>
|
||||||
|
</item>
|
||||||
|
"""
|
||||||
rss &= RESOURCES["rss_end"]
|
rss &= RESOURCES["rss_end"]
|
||||||
return rss
|
return rss
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<rss version="2.0">
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<rss version="2.0" xmlns:webfeeds="http://webfeeds.org/rss/1.0" xmlns:media="http://search.yahoo.com/mrss/">
|
||||||
<channel>
|
<channel>
|
||||||
<title>Pimvidious</title>
|
<title>Pimvidious</title>
|
||||||
<link>https://example.com</link>
|
<link>BASEURL</link>
|
||||||
|
<lastBuildDate>BUILDDATE</lastBuildDate>
|
||||||
|
<generator>Pimvidious</generator>
|
||||||
|
|
Loading…
Reference in a new issue