configurable user agent
This commit is contained in:
parent
c30deeed49
commit
983a57b3d7
@ -11,6 +11,7 @@ namespace ttrss_co_client
|
|||||||
public string OnDoneCopy { get; set; }
|
public string OnDoneCopy { get; set; }
|
||||||
public string WorkingDirectory { get; set; } = "./working/";
|
public string WorkingDirectory { get; set; } = "./working/";
|
||||||
public string ChatScript { get; set; }
|
public string ChatScript { get; set; }
|
||||||
|
public string UserAgent { get; set; }
|
||||||
public IEnumerable<FeedAction> feedActions { get; set; }
|
public IEnumerable<FeedAction> feedActions { get; set; }
|
||||||
public class FeedAction
|
public class FeedAction
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"onDoneCopy":"./",
|
"onDoneCopy":"./",
|
||||||
"workingDirectory":"working/",
|
"workingDirectory":"working/",
|
||||||
"chatScript": "miscChat.sh",
|
"chatScript": "miscChat.sh",
|
||||||
|
"userAgent": "Mozilla/5.0 (compatible; wget-is-not-a-crime/1.0)",
|
||||||
"feedActions":
|
"feedActions":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ namespace ttrss_co_client.tasks
|
|||||||
var extensionUpstream = attachmentLink.Substring(attachmentLink.LastIndexOf('.'));
|
var extensionUpstream = attachmentLink.Substring(attachmentLink.LastIndexOf('.'));
|
||||||
var downloadPath = Path.Combine(workingFolder, headline.title) + extensionUpstream;
|
var downloadPath = Path.Combine(workingFolder, headline.title) + extensionUpstream;
|
||||||
var downloader = new HttpClient();
|
var downloader = new HttpClient();
|
||||||
downloader.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; AcmeInc/1.0)");
|
downloader.DefaultRequestHeaders.UserAgent.ParseAdd(Conf.UserAgent);
|
||||||
sw.Start();
|
sw.Start();
|
||||||
var dlResult = (await downloader.GetAsync(attachmentLink));
|
var dlResult = (await downloader.GetAsync(attachmentLink));
|
||||||
File.WriteAllBytes(downloadPath, await dlResult.Content.ReadAsByteArrayAsync());
|
File.WriteAllBytes(downloadPath, await dlResult.Content.ReadAsByteArrayAsync());
|
||||||
|
Loading…
Reference in New Issue
Block a user