rhentai/Program.cs

44 lines
1.1 KiB
C#
Raw Normal View History

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