54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
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();
|
|
var Tags = new List<string>();
|
|
|
|
Tags = new Gallery.Gallery(HttpGalleryString).Tags;
|
|
int ID = new Gallery.Gallery(HttpGalleryString).GalleryId;
|
|
|
|
foreach (var Tag in Tags)
|
|
{
|
|
Console.Write(Tag);
|
|
}
|
|
Console.WriteLine(ID);
|
|
|
|
Console.WriteLine();
|
|
|
|
}
|
|
|
|
|
|
//
|
|
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();
|
|
}
|
|
|
|
|
|
}
|
|
}
|