mirror of
https://github.com/sbrl/PolyFeed.git
synced 2024-07-04 10:54:55 +00:00
Compare commits
No commits in common. "a8a9a33fa6d4c3ea7ef5701b06e045a2b90351f9" and "a060a10b55b85e9b35f77ce96e982fd96a79e45b" have entirely different histories.
a8a9a33fa6
...
a060a10b55
|
@ -111,32 +111,24 @@ namespace PolyFeed
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (source.Entries.LastUpdated != null) {
|
if (source.Entries.Published != null) {
|
||||||
nextItem.LastUpdated = DateTime.Parse(
|
nextItem.LastUpdated = DateTime.Parse(
|
||||||
nextNode.QuerySelectorAttributeOrText(
|
nextNode.QuerySelectorAttributeOrText(
|
||||||
source.Entries.LastUpdated
|
source.Entries.LastUpdated
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (source.Entries.Published != null) // Use the publish date if available
|
|
||||||
nextItem.LastUpdated = nextItem.Published;
|
|
||||||
else // It requires one, apparently
|
else // It requires one, apparently
|
||||||
nextItem.LastUpdated = DateTimeOffset.Now;
|
nextItem.LastUpdated = DateTimeOffset.Now;
|
||||||
|
|
||||||
|
SyndicationPerson author = new SyndicationPerson(
|
||||||
|
nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorName).Trim(),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
if(source.Entries.AuthorUrl != null)
|
||||||
|
author.Uri = nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorUrl);
|
||||||
|
|
||||||
if (source.Entries.AuthorName != null) {
|
nextItem.AddContributor(author);
|
||||||
SyndicationPerson author = new SyndicationPerson(
|
|
||||||
nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorName).Trim(),
|
|
||||||
""
|
|
||||||
);
|
|
||||||
if (source.Entries.AuthorUrl != null)
|
|
||||||
author.Uri = nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorUrl);
|
|
||||||
|
|
||||||
nextItem.AddContributor(author);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nextItem.AddContributor(new SyndicationPerson("Unknown", ""));
|
|
||||||
|
|
||||||
|
|
||||||
await feed.Write(nextItem);
|
await feed.Write(nextItem);
|
||||||
|
|
||||||
|
|
|
@ -96,14 +96,7 @@ namespace PolyFeed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SelectorSettings LastUpdated { get; set; }
|
public SelectorSettings LastUpdated { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The selector for the name of the author of an entry.
|
|
||||||
/// </summary>
|
|
||||||
public SelectorSettings AuthorName { get; set; }
|
public SelectorSettings AuthorName { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// The selector for the url that points to a page that represents
|
|
||||||
/// the author of an entry.
|
|
||||||
/// </summary>
|
|
||||||
public SelectorSettings AuthorUrl { get; set; }
|
public SelectorSettings AuthorUrl { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,6 @@ namespace PolyFeed.Helpers
|
||||||
if (selectedNode == null)
|
if (selectedNode == null)
|
||||||
throw new ApplicationException($"Error: Selector {settings.Selector} failed to find any elements.");
|
throw new ApplicationException($"Error: Selector {settings.Selector} failed to find any elements.");
|
||||||
|
|
||||||
// Hack: Add physical newlines to <br />s to make date parsing easier for LastUpdated / Published.
|
|
||||||
// Also means that we match Firefox functionality.
|
|
||||||
foreach (HtmlNode nextNode in htmlNode.QuerySelectorAll("br")) {
|
|
||||||
nextNode.InnerHtml = "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(settings.Attribute))
|
if (string.IsNullOrWhiteSpace(settings.Attribute))
|
||||||
return selectedNode.InnerText;
|
return selectedNode.InnerText;
|
||||||
|
|
||||||
|
@ -54,7 +48,7 @@ namespace PolyFeed.Helpers
|
||||||
if (node.Attributes["href"] != null) attributeName = "href";
|
if (node.Attributes["href"] != null) attributeName = "href";
|
||||||
if (node.Attributes["src"] != null) attributeName = "src";
|
if (node.Attributes["src"] != null) attributeName = "src";
|
||||||
|
|
||||||
if (attributeName == null || node.Attributes[attributeName] == null)
|
if (node.Attributes[attributeName] == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node.Attributes[attributeName].Value = new Uri(
|
node.Attributes[attributeName].Value = new Uri(
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
[feed]
|
|
||||||
output = "OCReMix-Remix-Albums.atom"
|
|
||||||
|
|
||||||
# Actual Official Feed: http://ocremix.org/feeds/ten20/
|
|
||||||
url = "https://ocremix.org/albums/"
|
|
||||||
|
|
||||||
source_type = "html"
|
|
||||||
|
|
||||||
title = "OCReMix Albums"
|
|
||||||
subtitle = "Latest Albums on OC ReMix"
|
|
||||||
|
|
||||||
logo_url = { selector = ".header", attribute = "src" }
|
|
||||||
|
|
||||||
[entries]
|
|
||||||
selector = ".area-link"
|
|
||||||
title = "{{a.main.featured}}"
|
|
||||||
content = """
|
|
||||||
<p>{td:first-child}</p>
|
|
||||||
<p>{td:nth-child(2)}</p>
|
|
||||||
"""
|
|
||||||
|
|
||||||
url = { selector = "a.main.featured", attribute = "href" }
|
|
||||||
# or, for a direct link to YouTube:
|
|
||||||
#url = { selector = "a.main.featured", attribute = "data-preview" }
|
|
||||||
|
|
||||||
# author_name = { selector = "" }
|
|
||||||
# author_url = { selector = "" }
|
|
||||||
|
|
||||||
published = { selector = "td:nth-child(4)", attribute = "" }
|
|
||||||
# last_updated = { selector = "", attribute = "" }
|
|
|
@ -1,32 +0,0 @@
|
||||||
[feed]
|
|
||||||
output = "OCReMix-Remixes.atom"
|
|
||||||
|
|
||||||
# Actual Official Feed: http://ocremix.org/feeds/ten20/
|
|
||||||
url = "https://ocremix.org/remixes/?&offset=0&sort=datedesc"
|
|
||||||
|
|
||||||
source_type = "html"
|
|
||||||
|
|
||||||
title = "OCReMixes"
|
|
||||||
subtitle = "Latest remixes on OC ReMix"
|
|
||||||
|
|
||||||
logo_url = { selector = ".header", attribute = "src" }
|
|
||||||
|
|
||||||
[entries]
|
|
||||||
selector = ".area-link"
|
|
||||||
title = "{{a.main.featured}} by {{td:nth-child(2) a.featured}} - {{.color-secondary}}"
|
|
||||||
content = """
|
|
||||||
<p>{a}</p>
|
|
||||||
<p><strong>{a.main.featured}</strong></p>
|
|
||||||
<p>{td:nth-child(2)}</p>
|
|
||||||
<p>Remixing {.color-secondary}</p>
|
|
||||||
"""
|
|
||||||
|
|
||||||
url = { selector = "a.main.featured", attribute = "href" }
|
|
||||||
# or, for a direct link to YouTube:
|
|
||||||
#url = { selector = "a.main.featured", attribute = "data-preview" }
|
|
||||||
|
|
||||||
author_name = { selector = "td:nth-child(2) a.featured" }
|
|
||||||
author_url = { selector = "td:nth-child(2) a.featured", attribute = "href" }
|
|
||||||
|
|
||||||
published = { selector = "td:nth-child(3)", attribute = "" }
|
|
||||||
# last_updated = { selector = "", attribute = "" }
|
|
Loading…
Reference in a new issue