rhentai/Program.cs
2021-05-28 21:07:18 +02:00

44 lines
1.1 KiB
C#

using System;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net.Http.Headers;
using System.IO;
using Gallery;
namespace rhentai{
// Program class
class Program{
// Creating a HttpClient
private static readonly HttpClient client = new HttpClient();
// Main function
static async Task Main(string[] args){
// Get Result from HttpGetGallery
string HttpGalleryString = await HttpGetGallery();
string variable = new Gallery.Gallery(1,HttpGalleryString).Tags_Section;
Console.Write(variable);
}
//
private static async Task<string> HttpGetGallery(){
// Create Task
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
var stringTask = client.GetStringAsync("https://nhentai.net/random/");
// Return Task Result
return (await stringTask).ToString();
}
}
}