diff --git a/AngleSharpTest/AngleSharpTest.csproj b/AngleSharpTest/AngleSharpTest.csproj new file mode 100644 index 0000000..bb98292 --- /dev/null +++ b/AngleSharpTest/AngleSharpTest.csproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + + diff --git a/AngleSharpTest/Program.cs b/AngleSharpTest/Program.cs new file mode 100644 index 0000000..717746f --- /dev/null +++ b/AngleSharpTest/Program.cs @@ -0,0 +1,25 @@ +using AngleSharp; +using System.Threading.Tasks; +using System; +using System.Linq; + +namespace AngleSharpTest +{ + class Program + { + static async Task Main(string[] args) + { + var config = Configuration.Default.WithDefaultLoader(); + var address = "https://en.wikipedia.org/wiki/List_of_The_Big_Bang_Theory_episodes"; + var context = BrowsingContext.New(config); + var document = await context.OpenAsync(address); + var cellSelector = "tr.vevent td:nth-child(3)"; + var cells = document.QuerySelectorAll(cellSelector); + var titles = cells.Select(m => m.TextContent); + foreach (var title in titles) + { + Console.WriteLine(title.ToString()); ; + } + } + } +} diff --git a/CsharpCorne/Program.cs b/CsharpCorne/Program.cs index da2061b..7ace052 100644 --- a/CsharpCorne/Program.cs +++ b/CsharpCorne/Program.cs @@ -9,9 +9,15 @@ namespace CsharpCorner static void Main(string[] args) { var web = new HtmlWeb(); - var doc = web.Load("https://www.avanza.se/aktier/lista.html"); +// var doc = web.Load("https://www.avanza.se/aktier/lista.html"); + var doc = web.Load("https://www.finansportalen.se/aktiekurser/"); + // var doc = web.Load("http://www.yellowpages.com/search?search_terms=Software&geo_location_terms=Sydney2C+ND"); + + // //*[@id="shareslist"]/table/tbody + // //*[@id="shareslist"]/table/tbody/tr[4]/td[1]/a var headerNames = doc.DocumentNode - .SelectNodes("//a[@class='ellipsis']").ToList(); + .SelectNodes("//*[@id='shareslist']/table/tbody/tr[1]/td[1]/a") + .ToList(); } } } diff --git a/HttpWebRequestType/HttpWebRequestType.csproj b/HttpWebRequestType/HttpWebRequestType.csproj new file mode 100644 index 0000000..2082704 --- /dev/null +++ b/HttpWebRequestType/HttpWebRequestType.csproj @@ -0,0 +1,8 @@ + + + + Exe + net5.0 + + + diff --git a/HttpWebRequestType/Program.cs b/HttpWebRequestType/Program.cs new file mode 100644 index 0000000..e80d289 --- /dev/null +++ b/HttpWebRequestType/Program.cs @@ -0,0 +1,29 @@ +using System; +using System.Net; + +namespace HttpWebRequestType +{ + class Program + { + static void Main(string[] args) + { + var url = "https://www.di.se/bors/aktier/"; + + Uri ourUri = new Uri(url); + + // Create a 'WebRequest' object with the specified url. + WebRequest myWebRequest = WebRequest.Create( url); + + // Send the 'WebRequest' and wait for response. + WebResponse myWebResponse = myWebRequest.GetResponse(); + + // Use "ResponseUri" property to get the actual Uri from where the response was attained. + if (ourUri.Equals(myWebResponse.ResponseUri)) + Console.WriteLine("\nRequest Url : {0} was not redirected", url); + else + Console.WriteLine("\nRequest Url : {0} was redirected to {1}", url, myWebResponse.ResponseUri); + // Release resources of response object. + myWebResponse.Close(); + } + } +} diff --git a/MailGunTest/MailGunTest.csproj b/MailGunTest/MailGunTest.csproj new file mode 100644 index 0000000..cf9cb69 --- /dev/null +++ b/MailGunTest/MailGunTest.csproj @@ -0,0 +1,16 @@ + + + + Exe + net5.0 + + + + + + + + + + + diff --git a/MailGunTest/Program.cs b/MailGunTest/Program.cs new file mode 100644 index 0000000..5120e66 --- /dev/null +++ b/MailGunTest/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace MailGunTest +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/MailGunTest/SendSimpleMailChunk.cs b/MailGunTest/SendSimpleMailChunk.cs new file mode 100644 index 0000000..f090036 --- /dev/null +++ b/MailGunTest/SendSimpleMailChunk.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using RestSharp; +using RestSharp.Authenticators; + +namespace MailGunTest +{ + public class SendSimpleMailChunk + { + public static void Main(string[] args) + { + Console.WriteLine(SendSimpleMessage().Content.ToString()); + } + public static IRestResponse SendSimpleMessage() + { + RestClient client = new RestClient(); + client.BaseUrl = new Uri("https://api.eu.mailgun.net/v3"); + client.Authenticator = new HttpBasicAuthenticator("api", "c416cb13b5937e7c2274f9f3038101cd-c485922e-70545ed4"); + + RestRequest request = new RestRequest(); + request.AddParameter("domain", "mg.tfoman.me", ParameterType.UrlSegment); + request.Resource = "{domain}/messages"; + request.AddParameter("from", "Excited User "); + request.AddParameter("to", "tommy@oeman.se"); + request.AddParameter("to", "tommy.oman@mg.tfoman.me"); + request.AddParameter("to", "tommy.oman@gmail.com"); + request.AddParameter("subject", "Api-sent message TEST"); + request.AddParameter("text", "Let's see how it works!"); + request.Method = Method.POST; + return client.Execute(request); + } + } +} + + diff --git a/OceanNetWorks/Form1.Designer.cs b/OceanNetWorks/Form1.Designer.cs new file mode 100644 index 0000000..140dc20 --- /dev/null +++ b/OceanNetWorks/Form1.Designer.cs @@ -0,0 +1,73 @@ + +namespace OceanNetWorks +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.scraperBox = new System.Windows.Forms.RichTextBox(); + this.btnScrape = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // scraperBox + // + this.scraperBox.Location = new System.Drawing.Point(12, 12); + this.scraperBox.Name = "scraperBox"; + this.scraperBox.Size = new System.Drawing.Size(768, 680); + this.scraperBox.TabIndex = 0; + this.scraperBox.Text = ""; + // + // btnScrape + // + this.btnScrape.Location = new System.Drawing.Point(364, 711); + this.btnScrape.Name = "btnScrape"; + this.btnScrape.Size = new System.Drawing.Size(75, 23); + this.btnScrape.TabIndex = 1; + this.btnScrape.Text = "Start"; + this.btnScrape.UseVisualStyleBackColor = true; + this.btnScrape.Click += new System.EventHandler(this.btnScrape_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(792, 758); + this.Controls.Add(this.btnScrape); + this.Controls.Add(this.scraperBox); + this.Name = "Form1"; + this.Text = "WebScraper"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.RichTextBox scraperBox; + private System.Windows.Forms.Button btnScrape; + } +} + diff --git a/OceanNetWorks/Form1.cs b/OceanNetWorks/Form1.cs new file mode 100644 index 0000000..a71ade4 --- /dev/null +++ b/OceanNetWorks/Form1.cs @@ -0,0 +1,107 @@ +using AngleSharp; +using AngleSharp.Dom; +using AngleSharp.Html.Dom; +using AngleSharp.Html.Parser; +using AngleSharp.Text; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OceanNetWorks +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private string Title { get; set; } + private string Url { get; set; } + private string siteUrl = "https://www.oceannetworks.ca/news/stories"; + //private string siteUrlx = "https://www.finansportalen.se/aktiekurser/"; + public string[] QueryTerms { get; } = { "Ocean", "Nature", "Pollution" }; + + + + internal async void ScrapeWebsite() + { + //var config = Configuration.Default + // .WithJs(); // from AngleSharp.Js + //var context = BrowsingContext.New(config); + + CancellationTokenSource cancellationToken = new CancellationTokenSource(); + HttpClient httpClient = new HttpClient(); + HttpResponseMessage request = await httpClient.GetAsync(siteUrl); + + cancellationToken.Token.ThrowIfCancellationRequested(); + + Stream response = await request.Content.ReadAsStreamAsync(); + cancellationToken.Token.ThrowIfCancellationRequested(); + + HtmlParser parser = new HtmlParser(); + + IHtmlDocument document = parser.ParseDocument(response); + + GetScrapeResults(document); + } + + private void GetScrapeResults(IHtmlDocument document) + { + IEnumerable articleLink = null; + + foreach (var term in QueryTerms) + { + articleLink = document.All.Where(x => + x.ClassName == "views-field views-field-nothing" && + (x.ParentElement.InnerHtml.Contains(term) || x.ParentElement.InnerHtml.Contains(term.ToLower()))); + } + + if (articleLink.Any()) + { + PrintResults(articleLink); + } + } + + public void PrintResults(IEnumerable articleLink) + { + // Clean Up Results: See Next Step + foreach (var element in articleLink) + { + CleanUpResults(element); + scraperBox.Text = $"{Title} - {Url}{Environment.NewLine}"; + } + } + + private void CleanUpResults(IElement result) + { + string htmlResult = result.InnerHtml.ReplaceFirst("
", "*"); + htmlResult = htmlResult.ReplaceFirst("
\n
", "-"); + htmlResult = htmlResult.ReplaceFirst("
\n
", ""); + + SplitResults(htmlResult); + } + + private void SplitResults(string htmlResult) + { + string[] splitResults = htmlResult.Split('*'); + Url = splitResults[0]; + Title = splitResults[1]; + } + + private void btnScrape_Click(object sender, EventArgs e) + { + ScrapeWebsite(); + } + } +} diff --git a/OceanNetWorks/Form1.resx b/OceanNetWorks/Form1.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/OceanNetWorks/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OceanNetWorks/OceanNetWorks.csproj b/OceanNetWorks/OceanNetWorks.csproj new file mode 100644 index 0000000..39e78ef --- /dev/null +++ b/OceanNetWorks/OceanNetWorks.csproj @@ -0,0 +1,13 @@ + + + + WinExe + net5.0-windows + true + + + + + + + \ No newline at end of file diff --git a/OceanNetWorks/Program.cs b/OceanNetWorks/Program.cs new file mode 100644 index 0000000..84855c7 --- /dev/null +++ b/OceanNetWorks/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OceanNetWorks +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/PuppeteerSharpTest/DtoEst.cs b/PuppeteerSharpTest/DtoEst.cs new file mode 100644 index 0000000..3d84623 --- /dev/null +++ b/PuppeteerSharpTest/DtoEst.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PuppeteerSharpTest +{ + public class DtoEst + { + public decimal EstBetrag { get; set; } + public decimal EstProzentsatz { get; set; } + } +} diff --git a/PuppeteerSharpTest/Form1.Designer.cs b/PuppeteerSharpTest/Form1.Designer.cs new file mode 100644 index 0000000..dccd0d3 --- /dev/null +++ b/PuppeteerSharpTest/Form1.Designer.cs @@ -0,0 +1,87 @@ + +namespace PuppeteerSharpTest +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.rtbWatcher = new System.Windows.Forms.RichTextBox(); + this.btnScrape = new System.Windows.Forms.Button(); + this.txtNettoUmsatz = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // rtbWatcher + // + this.rtbWatcher.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.rtbWatcher.Location = new System.Drawing.Point(12, 12); + this.rtbWatcher.Name = "rtbWatcher"; + this.rtbWatcher.Size = new System.Drawing.Size(776, 494); + this.rtbWatcher.TabIndex = 0; + this.rtbWatcher.Text = ""; + // + // btnScrape + // + this.btnScrape.Location = new System.Drawing.Point(377, 507); + this.btnScrape.Name = "btnScrape"; + this.btnScrape.Size = new System.Drawing.Size(75, 23); + this.btnScrape.TabIndex = 1; + this.btnScrape.Text = "Start"; + this.btnScrape.UseVisualStyleBackColor = true; + this.btnScrape.Click += new System.EventHandler(this.btnScrape_Click); + // + // txtNettoUmsatz + // + this.txtNettoUmsatz.Location = new System.Drawing.Point(84, 513); + this.txtNettoUmsatz.Name = "txtNettoUmsatz"; + this.txtNettoUmsatz.Size = new System.Drawing.Size(100, 23); + this.txtNettoUmsatz.TabIndex = 2; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 534); + this.Controls.Add(this.txtNettoUmsatz); + this.Controls.Add(this.btnScrape); + this.Controls.Add(this.rtbWatcher); + this.Name = "Form1"; + this.Text = "Puppeteer"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.RichTextBox rtbWatcher; + private System.Windows.Forms.Button btnScrape; + private System.Windows.Forms.TextBox txtNettoUmsatz; + } +} + diff --git a/PuppeteerSharpTest/Form1.cs b/PuppeteerSharpTest/Form1.cs new file mode 100644 index 0000000..31f2c36 --- /dev/null +++ b/PuppeteerSharpTest/Form1.cs @@ -0,0 +1,87 @@ +using PuppeteerSharp; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PuppeteerSharpTest +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private async void btnScrape_Click(object sender, EventArgs e) + { + var result = await LoadXXXAsync(); + + } + + private async Task LoadXXXAsync() + { + // downloads chromium to the local project, needed by Puppeteer Sharp for execution, takes about 2 min! + await new BrowserFetcher().DownloadAsync(); + // await new BrowserFetcher().DownloadAsync(DefaultChromiumRevision); + + DtoEst dto = new DtoEst(); + //var url = "https://www.xxxxxx.xhtml"; + var url = "https://www.bmf-steuerrechner.de/ekst/eingabeformekst.xhtml"; + + #region SELECTORS + // https://stackoverflow.com/questions/45110893/select-elements-by-attributes-with-colon + // use css escapes: https://mothereff.in/css-escapes + string id_checkbox_IsMarried = "bmf_form_ekst:ekst_pv:0"; + string id_input_Umsatz = "bmf_form_ekst:ekst_zve"; + string id_button_Submit2 = @"#bmf_form_ekst\3A income_ekst"; + string NettoUmsatz = txtNettoUmsatz.Text; + #endregion + + //// This statement downloads and installs chromium + //await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision); + var browser = await Puppeteer.LaunchAsync(new LaunchOptions + { + Headless = true + }); + + using (var page = await browser.NewPageAsync()) + { + // load page + await page.GoToAsync(url); + // wait for element to be there + await page.WaitForExpressionAsync($"document.getElementById('{id_input_Umsatz}')!=null"); + await page.EvaluateExpressionAsync($"document.getElementById('{id_input_Umsatz}').value = '{NettoUmsatz}';"); + // get element value + var val = await page.EvaluateFunctionAsync($"()=>document.getElementById('{id_input_Umsatz}').value"); + // wait for element to be there + await page.WaitForExpressionAsync($"document.getElementById('{id_checkbox_IsMarried}')!=null"); + await page.EvaluateExpressionAsync($"document.getElementById('{id_checkbox_IsMarried}').checked = false;"); + + await page.ClickAsync(id_button_Submit2); + // wait for redirect + await page.WaitForNavigationAsync(); + // get value from element + var strValueEst = await page.EvaluateFunctionAsync("()=>document.querySelector('#ui-id-4 > div.ekst_ergebnis > div:nth-child(6) > table > tbody > tr:nth-child(3) > td:nth-child(2) > strong').textContent"); + // get value from element + var strValueEstPercent = await page.EvaluateFunctionAsync("()=>document.querySelector('#ui-id-4 > div.ekst_ergebnis > div:nth-child(6) > table > tbody > tr:nth-child(3) > td:nth-child(3) > strong').textContent"); + + var deDE = new CultureInfo("de-DE"); + + Decimal.TryParse(strValueEst.TrimEnd(" Euro".ToCharArray()), NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint, deDE, out var decValueEst); + Decimal.TryParse(strValueEstPercent.TrimEnd(" %".ToCharArray()), NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint, deDE, out var decValueEstPercent); + + dto.EstBetrag = decValueEst; + dto.EstProzentsatz = decValueEstPercent; + } + + return await Task.FromResult(dto); + } + } +} diff --git a/PuppeteerSharpTest/Form1.resx b/PuppeteerSharpTest/Form1.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/PuppeteerSharpTest/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PuppeteerSharpTest/Program.cs b/PuppeteerSharpTest/Program.cs new file mode 100644 index 0000000..bf7a18b --- /dev/null +++ b/PuppeteerSharpTest/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PuppeteerSharpTest +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/PuppeteerSharpTest/PuppeteerSharpTest.csproj b/PuppeteerSharpTest/PuppeteerSharpTest.csproj new file mode 100644 index 0000000..1f15162 --- /dev/null +++ b/PuppeteerSharpTest/PuppeteerSharpTest.csproj @@ -0,0 +1,13 @@ + + + + WinExe + net5.0-windows + true + + + + + + + \ No newline at end of file diff --git a/Selenium/Program.cs b/Selenium/Program.cs new file mode 100644 index 0000000..7e51c51 --- /dev/null +++ b/Selenium/Program.cs @@ -0,0 +1,41 @@ +using OpenQA.Selenium; +using OpenQA.Selenium.Chrome; +using OpenQA.Selenium.Support.UI; +using System; +using System.Drawing.Imaging; +using System.IO; + +namespace Selenium +{ + class Program + { + static void Main(string[] args) + { + // Initialize the Chrome Driver + using (var driver = new ChromeDriver()) + { + // Go to the home page + driver.Navigate().GoToUrl("http://testing-ground.webscraping.pro/login"); + + // Get the page elements + var userNameField = driver.FindElementById("usr"); + var userPasswordField = driver.FindElementById("pwd"); + var loginButton = driver.FindElementByXPath("//input[@value='Login']"); + + // Type user name and password + userNameField.SendKeys("admin"); + userPasswordField.SendKeys("12345"); + + // and click the login button + loginButton.Click(); + + // Extract the text and save it into result.txt + var result = driver.FindElementByXPath("//div[@id='case_login']/h3").Text; + File.WriteAllText("result.txt", result); + + // Take a screenshot and save it into screen.png + driver.GetScreenshot().SaveAsFile(@"screen.png", ScreenshotImageFormat.Png); + } + } + } +} diff --git a/Selenium/Selenium.csproj b/Selenium/Selenium.csproj new file mode 100644 index 0000000..df6a66d --- /dev/null +++ b/Selenium/Selenium.csproj @@ -0,0 +1,17 @@ + + + + Exe + net5.0 + + + + + + + + + + + + diff --git a/WebClientScraper/Program.cs b/WebClientScraper/Program.cs new file mode 100644 index 0000000..708d4a6 --- /dev/null +++ b/WebClientScraper/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Net; +using System.Threading.Tasks; + +namespace WebClientScraper +{ + class Program + { + static void Main(string[] args) + { + using var client = new WebClient(); + + client.DownloadStringCompleted += (sender, e) => + { + Console.WriteLine(e.Result); + }; + + string url = "https://finansportalen.millistream.com/shares.php"; + client.DownloadStringAsync(new Uri(url)); + + Console.ReadLine(); + } + } +} diff --git a/WebClientScraper/WebClientScraper.csproj b/WebClientScraper/WebClientScraper.csproj new file mode 100644 index 0000000..2082704 --- /dev/null +++ b/WebClientScraper/WebClientScraper.csproj @@ -0,0 +1,8 @@ + + + + Exe + net5.0 + + + diff --git a/WebFlurl/Program.cs b/WebFlurl/Program.cs new file mode 100644 index 0000000..83958e1 --- /dev/null +++ b/WebFlurl/Program.cs @@ -0,0 +1,15 @@ +using Flurl.Http; +using System; +using System.Threading.Tasks; + +namespace WebFlurl +{ + class Program + { + static async Task Main(string[] args) + { + string result = await "https://www.di.se/bors/aktier/".GetStringAsync(); + Console.WriteLine(result); + } + } +} diff --git a/WebFlurl/WebFlurl.csproj b/WebFlurl/WebFlurl.csproj new file mode 100644 index 0000000..30adb70 --- /dev/null +++ b/WebFlurl/WebFlurl.csproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + + diff --git a/WebScrapeApp.sln b/WebScrapeApp.sln index eaa3678..0955383 100644 --- a/WebScrapeApp.sln +++ b/WebScrapeApp.sln @@ -3,11 +3,29 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31313.79 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebScrape", "WebScrape\WebScrape.csproj", "{DF64E211-B223-48C5-83F8-60792D8DFB04}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebScrape", "WebScrape\WebScrape.csproj", "{DF64E211-B223-48C5-83F8-60792D8DFB04}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsharpCorner", "CsharpCorne\CsharpCorner.csproj", "{BF147D4E-3654-4FF7-9B71-7E1B67CE7B0D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CsharpCorner", "CsharpCorne\CsharpCorner.csproj", "{BF147D4E-3654-4FF7-9B71-7E1B67CE7B0D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeadlessBrowser", "HeadlessBrowser\HeadlessBrowser.csproj", "{F0E685F6-9B05-42D1-B2F2-B14C861668A3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HeadlessBrowser", "HeadlessBrowser\HeadlessBrowser.csproj", "{F0E685F6-9B05-42D1-B2F2-B14C861668A3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfScraper", "WpfScraper\WpfScraper.csproj", "{C7CA27DE-F697-4001-A4A6-1AFCF373155B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebFlurl", "WebFlurl\WebFlurl.csproj", "{7437BA76-15CC-4CF2-AB72-4E6AD3DF6254}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebClientScraper", "WebClientScraper\WebClientScraper.csproj", "{2D12E885-2779-4D30-9C14-AAF9B5D6C821}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpWebRequestType", "HttpWebRequestType\HttpWebRequestType.csproj", "{9C3F1EC8-0B6A-4B6F-AEF7-503EA9EADE07}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Selenium", "Selenium\Selenium.csproj", "{36450C69-8A59-496B-A483-E697CA1F25B0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AngleSharpTest", "AngleSharpTest\AngleSharpTest.csproj", "{3CE0F660-46F5-4779-9C68-33634C2145E4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MailGunTest", "MailGunTest\MailGunTest.csproj", "{1549E3EC-FF09-4DC9-813D-96ECBC2B02CF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OceanNetWorks", "OceanNetWorks\OceanNetWorks.csproj", "{E02B7AA4-B7C5-49FB-8B74-7AEADA041194}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PuppeteerSharpTest", "PuppeteerSharpTest\PuppeteerSharpTest.csproj", "{A3A9F192-0881-40D0-9389-53C9AF7018F5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +45,42 @@ Global {F0E685F6-9B05-42D1-B2F2-B14C861668A3}.Debug|Any CPU.Build.0 = Debug|Any CPU {F0E685F6-9B05-42D1-B2F2-B14C861668A3}.Release|Any CPU.ActiveCfg = Release|Any CPU {F0E685F6-9B05-42D1-B2F2-B14C861668A3}.Release|Any CPU.Build.0 = Release|Any CPU + {C7CA27DE-F697-4001-A4A6-1AFCF373155B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7CA27DE-F697-4001-A4A6-1AFCF373155B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7CA27DE-F697-4001-A4A6-1AFCF373155B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7CA27DE-F697-4001-A4A6-1AFCF373155B}.Release|Any CPU.Build.0 = Release|Any CPU + {7437BA76-15CC-4CF2-AB72-4E6AD3DF6254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7437BA76-15CC-4CF2-AB72-4E6AD3DF6254}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7437BA76-15CC-4CF2-AB72-4E6AD3DF6254}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7437BA76-15CC-4CF2-AB72-4E6AD3DF6254}.Release|Any CPU.Build.0 = Release|Any CPU + {2D12E885-2779-4D30-9C14-AAF9B5D6C821}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D12E885-2779-4D30-9C14-AAF9B5D6C821}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D12E885-2779-4D30-9C14-AAF9B5D6C821}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D12E885-2779-4D30-9C14-AAF9B5D6C821}.Release|Any CPU.Build.0 = Release|Any CPU + {9C3F1EC8-0B6A-4B6F-AEF7-503EA9EADE07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C3F1EC8-0B6A-4B6F-AEF7-503EA9EADE07}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C3F1EC8-0B6A-4B6F-AEF7-503EA9EADE07}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C3F1EC8-0B6A-4B6F-AEF7-503EA9EADE07}.Release|Any CPU.Build.0 = Release|Any CPU + {36450C69-8A59-496B-A483-E697CA1F25B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36450C69-8A59-496B-A483-E697CA1F25B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36450C69-8A59-496B-A483-E697CA1F25B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36450C69-8A59-496B-A483-E697CA1F25B0}.Release|Any CPU.Build.0 = Release|Any CPU + {3CE0F660-46F5-4779-9C68-33634C2145E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CE0F660-46F5-4779-9C68-33634C2145E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CE0F660-46F5-4779-9C68-33634C2145E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CE0F660-46F5-4779-9C68-33634C2145E4}.Release|Any CPU.Build.0 = Release|Any CPU + {1549E3EC-FF09-4DC9-813D-96ECBC2B02CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1549E3EC-FF09-4DC9-813D-96ECBC2B02CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1549E3EC-FF09-4DC9-813D-96ECBC2B02CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1549E3EC-FF09-4DC9-813D-96ECBC2B02CF}.Release|Any CPU.Build.0 = Release|Any CPU + {E02B7AA4-B7C5-49FB-8B74-7AEADA041194}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E02B7AA4-B7C5-49FB-8B74-7AEADA041194}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E02B7AA4-B7C5-49FB-8B74-7AEADA041194}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E02B7AA4-B7C5-49FB-8B74-7AEADA041194}.Release|Any CPU.Build.0 = Release|Any CPU + {A3A9F192-0881-40D0-9389-53C9AF7018F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3A9F192-0881-40D0-9389-53C9AF7018F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3A9F192-0881-40D0-9389-53C9AF7018F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3A9F192-0881-40D0-9389-53C9AF7018F5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WpfScraper/App.xaml b/WpfScraper/App.xaml new file mode 100644 index 0000000..ae0ae72 --- /dev/null +++ b/WpfScraper/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WpfScraper/App.xaml.cs b/WpfScraper/App.xaml.cs new file mode 100644 index 0000000..6a95d43 --- /dev/null +++ b/WpfScraper/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WpfScraper +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/WpfScraper/AssemblyInfo.cs b/WpfScraper/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/WpfScraper/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/WpfScraper/EntryModel.cs b/WpfScraper/EntryModel.cs new file mode 100644 index 0000000..61c90e2 --- /dev/null +++ b/WpfScraper/EntryModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WpfScraper +{ + public class EntryModel + { + public string Title { get; set; } + public string Description { get; set; } + } +} diff --git a/WpfScraper/MainWindow.xaml b/WpfScraper/MainWindow.xaml new file mode 100644 index 0000000..3467193 --- /dev/null +++ b/WpfScraper/MainWindow.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + +