49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Headers;
|
|
using System.IO;
|
|
|
|
namespace rhentai
|
|
{
|
|
class Program
|
|
{
|
|
private static readonly HttpClient client = new HttpClient();
|
|
|
|
static async Task Main(string[] args){
|
|
await ProcessRepositories();
|
|
}
|
|
|
|
private static async Task ProcessRepositories(){
|
|
|
|
client.DefaultRequestHeaders.Accept.Clear();
|
|
client.DefaultRequestHeaders.Accept.Add(
|
|
new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
|
|
// client.DefaultRequestHeaders.Add("User-Agent", ".NET Foundation Repository Reporter");
|
|
|
|
var stringTask = client.GetStringAsync("https://nhentai.net/random/");
|
|
|
|
var msg = await stringTask;
|
|
|
|
//Console.Write(msg);
|
|
|
|
await File.WriteAllTextAsync("output.txt", msg);
|
|
|
|
var fileRead = File.ReadAllTextAsync("output.txt");
|
|
|
|
var textread = await fileRead;
|
|
int index_tags_start = textread.IndexOf("Tags:");
|
|
int index_tags_end = textread.IndexOf("Artists:");
|
|
|
|
string filteredoutput = "";
|
|
|
|
for (int i = index_tags_start; i < index_tags_end; i++){
|
|
filteredoutput += textread[i];
|
|
}
|
|
|
|
Console.Write(filteredoutput);
|
|
|
|
}
|
|
}
|
|
}
|