Alte Quellcode bestand wiederhergestellt
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.11.0" />
|
||||
<PackageReference Include="Selenium.UndetectedChromeDriver" Version="1.1.2-alpha" />
|
||||
<PackageReference Include="Selenium.WebDriver" Version="4.16.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using SeleniumUndetectedChromeDriver;
|
||||
using OpenQA.Selenium;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using ConsoleApp3.Contracts;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
@@ -31,19 +33,44 @@ namespace CardmarketBot
|
||||
|
||||
public List<Kunde> ParseCardMarket(string forceid = "")
|
||||
{
|
||||
//var driver = UndetectedChromeDriver.Create(driverExecutablePath: await new ChromeDriverInstaller().Auto());
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
options.AddArgument("start-maximized");
|
||||
options.AddArgument("incognito");
|
||||
options.AddArgument("disable-popup-blocking");
|
||||
//options.AddArgument("incognito");
|
||||
//options.AddArgument("disable-popup-blocking");
|
||||
options.AddArgument("force-device-scale-factor=0.8");
|
||||
IWebDriver cd = new ChromeDriver(options);
|
||||
|
||||
//driver.GoToUrl("https://www.cardmarket.com/de/OnePiece");
|
||||
|
||||
|
||||
cd.Url = @"https://www.cardmarket.com/de/OnePiece";
|
||||
|
||||
cd.Navigate();
|
||||
|
||||
cd.FindElement(By.CssSelector("#CookiesConsent > div > div > form > button")).Click();
|
||||
Thread.Sleep(10);
|
||||
Thread.Sleep(2000);
|
||||
|
||||
IWebElement? element;
|
||||
|
||||
/*
|
||||
bool cloudfire = true;
|
||||
|
||||
|
||||
if (cloudfire)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Scheint als würde Cloudfire aktiviert sein.");
|
||||
Console.WriteLine("Bitte bestätige und komme zurück und klicke die buchstabe c und Enter");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
cd.FindElement(By.CssSelector("#CookiesConsent > div > div > form > div > button")).Click();
|
||||
|
||||
Thread.Sleep(2000);
|
||||
|
||||
cd.FindElement(By.Name("username")).Click();
|
||||
cd.FindElement(By.Name("username")).SendKeys(username);
|
||||
|
||||
@@ -52,6 +79,8 @@ namespace CardmarketBot
|
||||
|
||||
cd.FindElement(By.CssSelector("#header-login > input.btn.btn-outline-primary.btn-sm")).Click();
|
||||
|
||||
Thread.Sleep(6000);
|
||||
|
||||
|
||||
CookieContainer cookieContainer = new CookieContainer();
|
||||
foreach (var c in cd.Manage().Cookies.AllCookies)
|
||||
@@ -63,11 +92,47 @@ namespace CardmarketBot
|
||||
|
||||
List<string> ids = new List<string>();
|
||||
List<Kunde> kunden = new List<Kunde>();
|
||||
IWebElement element;
|
||||
//IWebElement? element;
|
||||
|
||||
/*cloudfire = true;
|
||||
|
||||
try
|
||||
{
|
||||
element = cd.FindElement(By.XPath("/html/body/div[1]/div/div[1]/div"));
|
||||
|
||||
// //[@id="challenge-body-text"]
|
||||
}
|
||||
catch (NoSuchElementException)
|
||||
{
|
||||
cloudfire = false;
|
||||
}
|
||||
|
||||
Console.WriteLine(cloudfire);
|
||||
|
||||
if(cloudfire )
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Scheint als würde Cloudfire aktiviert sein.");
|
||||
Console.WriteLine("Bitte bestätige und komme zurück und klicke die buchstabe c und Enter");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
if (forceid != "")
|
||||
{
|
||||
ids.Add(forceid);
|
||||
string[] mid = forceid.Split(',');
|
||||
if (mid.Length < 0)
|
||||
{
|
||||
ids.Add(forceid);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(string kid in mid)
|
||||
{
|
||||
ids.Add(kid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -75,15 +140,16 @@ namespace CardmarketBot
|
||||
|
||||
try
|
||||
{
|
||||
element = cd.FindElement(By.XPath("/html/body/main/section/div[3]/div[4]"));
|
||||
|
||||
string content = element.Text;
|
||||
string[] datas = content.Split("\r\n");
|
||||
|
||||
for (int i = 8; i < datas.Length; i += 7)
|
||||
var verkaufstable = cd.FindElements(By.XPath("/html/body/main/section/div[3]/div[4]/div[2]/*"));
|
||||
|
||||
foreach(var karte in verkaufstable)
|
||||
{
|
||||
ids.Add(datas[i]);
|
||||
var content = karte.Text.Split("\r\n");
|
||||
// 10 Stellen ist die ID
|
||||
ids.Add(content[1]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (OpenQA.Selenium.NotFoundException)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace CardMarketBot
|
||||
{
|
||||
try
|
||||
{
|
||||
TcpClient client = new TcpClient("nas.cosysda.de", 4000);
|
||||
TcpClient client = new TcpClient("huskyteufel.ddnss.de", 4000);
|
||||
Write(client, string.Format("#TEST#{0}", verkaufsnummer));
|
||||
EResult result = Read(client);
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace CardMarketBot
|
||||
|
||||
return result == EResult.OK;
|
||||
}
|
||||
catch(SocketException)
|
||||
catch(SocketException ex)
|
||||
{
|
||||
throw new SocketException();
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace CardMarketBot
|
||||
|
||||
public bool Write(string verkaufsnummer)
|
||||
{
|
||||
TcpClient client = new TcpClient("nas.cosysda.de", 4000);
|
||||
TcpClient client = new TcpClient("huskyteufel.ddnss.de", 4000);
|
||||
Write(client, string.Format("#WRITE#{0}", verkaufsnummer));
|
||||
EResult result = Read(client);
|
||||
client.Client.Shutdown(SocketShutdown.Both);
|
||||
|
||||
@@ -17,7 +17,6 @@ public static class Helper
|
||||
}
|
||||
internal static Kunde ConvertToKunde(string text)
|
||||
{
|
||||
|
||||
string[] datas = text.Split("\r\n");
|
||||
string name = datas[0];
|
||||
string adresseUNDHausnummer = datas[datas.Length-3];
|
||||
@@ -31,7 +30,7 @@ public static class Helper
|
||||
datas = adresseUNDHausnummer.Split(" ");
|
||||
string strasse = "";
|
||||
string hausnummer = "";
|
||||
Trace.WriteLine(datas.Length);
|
||||
//Trace.WriteLine(datas.Length);
|
||||
if (datas.Length <= 1)
|
||||
{
|
||||
Regex myRegex = new Regex("[0-9]*$");
|
||||
@@ -49,7 +48,6 @@ public static class Helper
|
||||
hausnummer = datas[datas.Length - 1];
|
||||
}
|
||||
return new Kunde(name, strasse, hausnummer, plz, ort, land);
|
||||
|
||||
}
|
||||
|
||||
public static List<Artikel> ParseArtikeln(string text)
|
||||
@@ -105,7 +103,7 @@ public static class Helper
|
||||
temp.Source = datas[j];
|
||||
}
|
||||
}
|
||||
Trace.WriteLine(j + " " + datas[j]);
|
||||
//Trace.WriteLine(j + " " + datas[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -129,26 +127,4 @@ public static class Helper
|
||||
|
||||
return DateTime.Parse(string.Format("{0} {1}", datum, uhrzeit));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid");
|
||||
hwr.CookieContainer = cookieContainer;
|
||||
hwr.Method = "GET";
|
||||
hwr.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
||||
WebResponse wr = hwr.GetResponse();
|
||||
string s = new StreamReader(wr.GetResponseStream()).ReadToEnd();
|
||||
Console.WriteLine(s);
|
||||
|
||||
string GetHashKey(string line)
|
||||
{
|
||||
var x = line.IndexOf("__cmtkn");
|
||||
var d = line.Substring(x + 16);
|
||||
var m = d.IndexOf("\"");
|
||||
var a = d.Substring(0, m);
|
||||
return a;
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
using ConsoleApp3.Contracts;
|
||||
using System.Text.RegularExpressions;
|
||||
using CardMarketBot;
|
||||
using OpenQA.Selenium.DevTools.V113.Network;
|
||||
using OpenQA.Selenium.DevTools.V119.Network;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
|
||||
namespace CardmarketBot
|
||||
@@ -13,16 +13,17 @@ namespace CardmarketBot
|
||||
{
|
||||
ICheckSevDesk checkSevDesk = new CheckSevDeskPublicList();
|
||||
|
||||
Console.WriteLine("Hallo Herzlich willkommen beim Junker sein Junker der im Junkerloch junkert");
|
||||
Console.WriteLine("Hallo Herzlich willkommen Augustin Karneval e.V.");
|
||||
Console.WriteLine("Was kann ich für dich tun?");
|
||||
bool programmexited = false;
|
||||
List<Kunde> kunden = new List<Kunde>();
|
||||
CardMarketParser cardMarketParser = new CardMarketParser("More-Tcg", "Magnatpower310!!");
|
||||
while (!programmexited)
|
||||
{
|
||||
Console.WriteLine("1) Starte den Hugo, der alle bezahlte Artikeln erfasst");
|
||||
Console.WriteLine("2) Starte den Rolfes der Bestellnummern nachkontrolliert");
|
||||
Console.WriteLine("3) Beende");
|
||||
Console.WriteLine("1) Starte den Konstantin, der alle bezahlte Artikeln erfasst");
|
||||
Console.WriteLine("2) Starte den Pöttker der Bestellnummern nachkontrolliert");
|
||||
Console.WriteLine("3) Reset der Augen, gut wenn man Pöttkers Frau gesehen hat");
|
||||
Console.WriteLine("4) Beende");
|
||||
string? input = Console.ReadLine();
|
||||
if (input == null)
|
||||
{
|
||||
@@ -48,11 +49,15 @@ namespace CardmarketBot
|
||||
break;
|
||||
|
||||
case "3":
|
||||
DoShit();
|
||||
break;
|
||||
case "4":
|
||||
programmexited = true;
|
||||
continue;
|
||||
default: continue;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Rechnungen generieren
|
||||
List<ModelRechnung> rechnungen = new List<ModelRechnung>();
|
||||
@@ -85,11 +90,27 @@ namespace CardmarketBot
|
||||
}
|
||||
|
||||
// Post CSV Erstellen
|
||||
DeutschePost deutschePost = new DeutschePost(kunden);
|
||||
deutschePost.GenerateCSV();
|
||||
//DeutschePost deutschePost = new DeutschePost(kunden);
|
||||
//deutschePost.GenerateCSV();
|
||||
|
||||
Console.WriteLine("Fertig");
|
||||
}
|
||||
}
|
||||
|
||||
private static void DoShit()
|
||||
{
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
Console.Beep(38, 3);
|
||||
Console.BackgroundColor = ConsoleColor.Green;
|
||||
Console.Clear();
|
||||
Thread.Sleep(100);
|
||||
Console.BackgroundColor = ConsoleColor.Red;
|
||||
Console.Clear();
|
||||
}
|
||||
Console.BackgroundColor = ConsoleColor.Black;
|
||||
Console.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user