Skip to content

Commit

Permalink
v.0.4.0.0
Browse files Browse the repository at this point in the history
Adapt to 2019.12.31 FA template changes.
  • Loading branch information
crouvpony47 committed Jan 1, 2020
1 parent 7e63b59 commit 992880a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 36 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ Yet another mass downloader for FurAffinity.net.

[Download stable win32 builds.](https://github.com/crouvpony47/furdown/releases)

### Changelog (v.0.3.7.0)
- added naming templates for submission title and publication date
- true portable more with no traces is AppData (to activate, put an initially empty file called `furdown-portable.conf` in the working directory; it is assumed to be writable)
### Changelog (v.0.4.0.0)
- adapt to the FA template changes

### System requirements
- Windows Vista SP2 or newer, might not work on server editions
- .NET 4.5
- *Having IE11 installed is strongly recommended for better login experience*

### Portable mode

To leave no traces in ApplicationData directory you can create an empty file called `furdown-portable.conf` in the working directory, it will then be used as a settings storage file instead of the default `%AppData%\furdown\furdown.conf`.

### Batch/CLI mode
v.0.3.6 has a basic support for being run within a batch script, or from a terminal.

Expand Down
65 changes: 36 additions & 29 deletions src/AppCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,35 +302,36 @@ public async Task<ProcessingResults> ProcessSubmissionsList(List<string> subs, b
{
Utils.FillPropertiesFromDateTime(DateTime.Now, sp); // set Now as a fallback date
sp.TITLE = "Unknown"; // fallback title

// extract description
cpage = cpage.Substring(cpage.IndexOf(desckey, StringComparison.Ordinal));
const string desckeyend = "</div>";
cpage = cpage.Substring(0,
cpage.IndexOf(desckeyend, cpage.IndexOf(desckeyend, StringComparison.Ordinal) + 1,
StringComparison.Ordinal) + desckeyend.Length
);
cpage = cpage.Replace("href=\"/", "href=\"https://furaffinity.net/");
cpage = cpage.Replace("src=\"//", "src=\"https://");

// title
const string key_title = @"<div class=""submission-title"">";
const string key_enddiv = "</div>";
cpage = cpage.Substring(cpage.IndexOf(key_title, StringComparison.Ordinal));
string sub_title_div = cpage.Substring(0,
cpage.IndexOf(key_enddiv, cpage.IndexOf(key_enddiv, StringComparison.Ordinal) + 1,
StringComparison.Ordinal) + key_enddiv.Length);
var titleMatch = Regex.Match(sub_title_div, "<h2><p>(.+?)</p></h2>", RegexOptions.CultureInvariant);
if (titleMatch.Success)
{
sp.TITLE = Utils.StripIllegalFilenameChars(titleMatch.Groups[1].Value);
Console.WriteLine("Title: " + sp.TITLE);
}
else Console.WriteLine("Warning :: no submission title found!");

// replace relative date with the absolute one
var dateMatch = Regex.Match(cpage, "title=\"(.+?)\" class=\"popup_date\">(.+?)<", RegexOptions.CultureInvariant);
string sub_date_strong = "";
var dateMatch = Regex.Match(cpage, "<strong.+?title=\"(.+?)\" class=\"popup_date\">(.+?)<.+?</strong>", RegexOptions.CultureInvariant);
if (dateMatch.Success)
{
string dateMatchVal = dateMatch.Value;
string dateTimeStr = dateMatch.Groups[1].Value; // fixed format date

// replace relative date with a fixed format one
string dateMatchValNew = dateMatchVal.Replace(dateMatch.Groups[2].Value, dateTimeStr);
cpage = cpage.Replace(dateMatchVal, dateMatchValNew);
// replace relative date with a fixed format one
sub_date_strong = dateMatchVal.Replace(dateMatch.Groups[2].Value, dateTimeStr);

// parse date
var dateTimeInternalMatch = Regex.Match(dateTimeStr, @"\d([^\d].+?,)", RegexOptions.CultureInvariant);
if (dateTimeInternalMatch.Success)
{
string matchVal = dateTimeInternalMatch.Value;
string matchValNew = matchVal.Replace(dateTimeInternalMatch.Groups[1].Value, "");
dateTimeStr = dateTimeStr.Replace(matchVal, matchValNew);
// parse date
dateTimeStr = dateTimeStr.Replace(",", "");
{
const string dateFormat = "MMM d yyyy hh:mm tt";
try
{
Expand All @@ -345,14 +346,20 @@ public async Task<ProcessingResults> ProcessSubmissionsList(List<string> subs, b
}
else Console.WriteLine("Warning :: unable to extact submission date");

// get the title
var titleMatch = Regex.Match(cpage, "<h2.+?submission-title-header.+?>(.+?)<", RegexOptions.CultureInvariant);
if (titleMatch.Success)
{
sp.TITLE = Utils.StripIllegalFilenameChars(titleMatch.Groups[1].Value);
Console.WriteLine("Title: " + sp.TITLE);
}
else Console.WriteLine("Warning :: unable to extact submission title");
// extract description
const string key_desc = @"<div class=""submission-description"">";
cpage = cpage.Substring(cpage.IndexOf(key_desc, StringComparison.Ordinal));
cpage = cpage.Substring(0,
cpage.IndexOf(key_enddiv, cpage.IndexOf(key_enddiv, StringComparison.Ordinal) + 1,
StringComparison.Ordinal) + key_enddiv.Length);
cpage = cpage.Replace("href=\"/", "href=\"https://furaffinity.net/");
cpage = cpage.Replace("src=\"//", "src=\"https://");

cpage = @"<div class=""submission-description-container link-override"">
<div class=""submission-title"">
<h2 class=""submission-title-header"">{{{title}}}</h2>
Posted {{{date}}}
</div><hr>".Replace("{{{title}}}", sp.TITLE).Replace("{{{date}}}", sub_date_strong) + cpage;
}

sp.ARTIST = sp.URL.Substring(sp.URL.LastIndexOf(@"/art/") + 5);
Expand Down
6 changes: 3 additions & 3 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("crouvpony47")]
[assembly: AssemblyProduct("furdown")]
[assembly: AssemblyCopyright("Copyright © 2017-2019, crouvpony47")]
[assembly: AssemblyCopyright("Copyright © 2017-2020, crouvpony47")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("8b45577e-b5d1-4056-96e6-b2647e18b867")]

[assembly: AssemblyVersion("0.3.7.0")]
[assembly: AssemblyFileVersion("0.3.7.0")]
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: NeutralResourcesLanguage("en")]

2 changes: 1 addition & 1 deletion src/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="0.3.7.0" name="Furdown.app"/>
<assemblyIdentity version="0.4.0.0" name="Furdown.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down

0 comments on commit 992880a

Please sign in to comment.