Обновите состояние Твиттера в C#

Да Вы можете. Пример:

DELETE TableA 
FROM TableA AS a
INNER JOIN TableB AS b
ON a.BId = b.BId
WHERE [filter condition]
5
задан Community 23 May 2017 в 12:01
поделиться

4 ответа

Если вам нравится Twitterizer Framework, но вам просто не нравится отсутствие исходного кода, почему бы не загрузить исходный код ? (Или просмотрите его , если вы просто хотите увидеть, что он делает ...)

10
ответ дан 18 December 2019 в 07:10
поделиться

Еще одна библиотека Twitter, которую я успешно использовал, - это TweetSharp , которая предоставляет свободный API.

Исходный код доступен по адресу Код Google . Почему вы не хотите использовать dll? Это, безусловно, самый простой способ включить библиотеку в проект.

3
ответ дан 18 December 2019 в 07:10
поделиться

Я не поклонник изобретения колеса заново, особенно когда речь идет об уже существующих продуктах, обеспечивающих 100% требуемой функциональности. На самом деле у меня есть исходный код для Twitterizer , работающего рядом с моим приложением ASP.NET MVC, чтобы я мог внести любые необходимые изменения ...

Если вам действительно не нужна ссылка в DLL на существуют, вот пример того, как кодировать обновления на C #. Проверьте это в dreamincode .

/*
 * A function to post an update to Twitter programmatically
 * Author: Danny Battison
 * Contact: gabehabe@hotmail.com
 */

/// <summary>
/// Post an update to a Twitter acount
/// </summary>
/// <param name="username">The username of the account</param>
/// <param name="password">The password of the account</param>
/// <param name="tweet">The status to post</param>
public static void PostTweet(string username, string password, string tweet)
{
    try {
        // encode the username/password
        string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + password));
        // determine what we want to upload as a status
        byte[] bytes = System.Text.Encoding.ASCII.GetBytes("status=" + tweet);
        // connect with the update page
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://twitter.com/statuses/update.xml");
        // set the method to POST
        request.Method="POST";
        request.ServicePoint.Expect100Continue = false; // thanks to argodev for this recent change!
        // set the authorisation levels
        request.Headers.Add("Authorization", "Basic " + user);
        request.ContentType="application/x-www-form-urlencoded";
        // set the length of the content
        request.ContentLength = bytes.Length;

        // set up the stream
        Stream reqStream = request.GetRequestStream();
        // write to the stream
        reqStream.Write(bytes, 0, bytes.Length);
        // close the stream
        reqStream.Close();
    } catch (Exception ex) {/* DO NOTHING */}
}
7
ответ дан 18 December 2019 в 07:10
поделиться

Самый простой способ публиковать материалы в Твиттере - использовать базовую аутентификацию , что не очень надежно.

    static void PostTweet(string username, string password, string tweet)
    {
         // Create a webclient with the twitter account credentials, which will be used to set the HTTP header for basic authentication
         WebClient client = new WebClient { Credentials = new NetworkCredential { UserName = username, Password = password } };

         // Don't wait to receive a 100 Continue HTTP response from the server before sending out the message body
         ServicePointManager.Expect100Continue = false;

         // Construct the message body
         byte[] messageBody = Encoding.ASCII.GetBytes("status=" + tweet);

         // Send the HTTP headers and message body (a.k.a. Post the data)
         client.UploadData("http://twitter.com/statuses/update.xml", messageBody);
    }
1
ответ дан 18 December 2019 в 07:10
поделиться
Другие вопросы по тегам:

Похожие вопросы: