Advertisement
CassataGames

Untitled

Apr 1st, 2020
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using System.Net;
  6. using System.IO;
  7. using Newtonsoft.Json;
  8.  
  9. public class ProfanityCheck : MonoBehaviour
  10. {
  11.     public InputField InputText;
  12.     public Text OutputText;
  13.     static WebClient client = new WebClient();
  14.     public List<string> Names;
  15.  
  16.     public static string[] Swears(List<string> Names)
  17.     {
  18.         client.Headers.Add("X-RapidAPI-Host", "community-purgomalum.p.rapidapi.com");
  19.         client.Headers.Add("X-RapidAPI-Key", "60c1c1e164msh25c21e494ffc25dp19877fjsna0b55ab01dd5");
  20.         foreach (string i in Names)
  21.         {
  22.             client.QueryString.Add("text", i);
  23.         }
  24.         Stream data = client.OpenRead("https://community-purgomalum.p.rapidapi.com/json");
  25.         StreamReader reader = new StreamReader(data);
  26.         string text = reader.ReadToEnd();
  27.         RootObject R = new RootObject();
  28.  
  29.         R = JsonConvert.DeserializeObject<RootObject>(text);
  30.  
  31.         string[] Censored;
  32.         Censored = R.result.Split(',');
  33.         return Censored;
  34.     }
  35. }
  36.  
  37. [System.Serializable]
  38. public class RootObject
  39. {
  40.     public string result { get; set; }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement