Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
- namespace TwitchWords
- {
- public class Program
- {
- static void Main(string[] args)
- {
- var cookie = "";
- var words = GetWords().Where(x => x.Length > 3);
- var baseUrl = "https://passport.twitch.tv/usernames/";
- // Get the stream containing content returned by the server.
- foreach (var word in words)
- {
- try
- {
- var url = baseUrl + word;
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
- request.Headers["Cookie"] = cookie;
- var response = (HttpWebResponse)request.GetResponse();
- if (response.StatusCode == HttpStatusCode.OK)
- {
- // Bad response
- }
- else if (response.StatusCode == HttpStatusCode.NoContent)
- {
- // Good Resposne
- Console.WriteLine(word);
- //Thread.Sleep(5000);
- }
- }
- catch
- {
- Console.WriteLine("fail");
- }
- }
- Console.WriteLine("End of program");
- Console.ReadKey();
- }
- public static List<string> GetWords()
- {
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english.txt");
- var response = (HttpWebResponse)request.GetResponse();
- Stream dataStream = response.GetResponseStream();
- // Open the stream using a StreamReader for easy access.
- StreamReader reader = new StreamReader(dataStream);
- // Read the content.
- string responseFromServer = reader.ReadToEnd();
- // Clean up the streams and the response.
- reader.Close();
- response.Close();
- return new List<string>(responseFromServer.Split("\n"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement