I am writing a twitter bot for the console. My tape should go to the console. I use library TweetSharp .
The essence of the problem:
I registered the application on Twitter , it was normally authorized yesterday, and today it writes "that there is no access to the application". I understand that the keys have expired and it is necessary to somehow somehow request a new
SecretKeyandConsumerKey? Authorization happens under the OAuth2.0 protocol.The method does not work with the output tweet tape in the console. Can you suggest a working method or point out an error?
Advise where to get the documentation on TweetSharp , on GitHub very little information.
Actually, the code :
using System; using TweetSharp; using System.Diagnostics; namespace twit_bot { class Program { static void Main(string[] args) { // Передаем свои учетные данные сервису (SecretKey, KonsumerKey) TwitterService service = new TwitterService("**********************", "***************************"); // Шаг 1 - получаем маркер запроса протокола OAuth OAuthRequestToken requestToken = service.GetRequestToken(); // Шаг 2 - перенаправление по URL авторизации OAuth Uri uri = service.GetAuthorizationUri(requestToken); Process.Start(uri.ToString()); // Step 3 - меняем маркер доступа на маркер string verifier = "12345"; // <-- Вводится пользователем OAuthAccessToken access = service.GetAccessToken(requestToken, verifier); //Читаем ленту TwitterService myTwitterService = new TwitterService(); var options = new ListTweetsOnUserTimelineOptions { ScreenName = "sinecuraweb" }; foreach (var tweet in myTwitterService.ListTweetsOnUserTimeline(options)) Console.WriteLine(tweet.Text); } } }