yortw / tweetmoasharp Goto Github PK
View Code? Open in Web Editor NEWThis project forked from shugonta/tweetsharp
TweetSharp is a fast, clean wrapper around the Twitter API.
License: Other
This project forked from shugonta/tweetsharp
TweetSharp is a fast, clean wrapper around the Twitter API.
License: Other
there is unretweet in official API but not in moasharp. I'm using delete api to undo retweet but it is not good for undo self retweet. Is it not added yet or not supported?
I pulled down your package from NuGet for use in a windows store app. I tested it with my test console and everything works great. When I added the package to the windows store app I am getting an error indicating GetRequestToken() requires at least 1 parameter, which doesnt seem to be required in my test use of the package.
I'm using the latest TweetMoaSharp and am a bit baffled with this error.
It is in a server environment, where the client sends us the accessToken and accessTokenSecret to be stored online. I'm running the following code:
var service = new TwitterService("consumerKey", "consumerKeySecret");
service.AuthenticateWith("accessToken", "accessTokenSecret");
var result = service.SendTweet(new SendTweetOptions { Status = "Test post" });
However at the end, result is null, and the post does not appear.
Newbie using Twitter with those targets and questions:
Which latest API Twitter ?
Limitations for get tweets, download images, etc ?
How can I get your all tweets list ?
And download photos and videos from anyone timeline too ?
How get the list of followers and following ?
How send DM anyone user ?
How can I follow to user ?
How manage lists ?
How get favorites lists ?
I want to do it programmatically using C# but for .NET, I have not seen many samples official Twitter:
NOw, I have found 2 API: TweetSharp vs Tweetmoasharp
https://github.com/danielcrenna/tweetsharp
https://github.com/Yortw/tweetmoasharp/
Which is the recommended ? Can I do all my targets ?
Mindly notes:
Any good getting started with Tweetmoasharp? step by step in 10 minutes?
IMHO, better samples for minimize learning curve are real applications with full source code and good patterns and practices
Full source code sample REAL application? not Demo, only real applications?
Like for small to medium applications development, but open source, if you can sharing or maybe another real project or production-ready application using.
main influences, are full of innovative ideas that can free our minds to explore new techniques, patterns and paradigms.
You want to use technologies that allow for rapid development, constant iteration, maximal efficiency, speed, robustness and more. You want to be lean and you want to be agile. You want to use technologies that will help you succeed in the short and long term. And those technologies are not always easy to pick out.
Mindly notes 2
Why not working together ?
https://tweetinvi.codeplex.com/90
https://www.nuget.org/packages/TweetinviAPI45
https://linqtotwitter.codeplex.com/36
https://www.nuget.org/packages/linqtotwitter28
https://github.com/opentig/TwitterIrcGateway30
https://github.com/danielcrenna/tweetsharp
https://github.com/Yortw/tweetmoasharp/
If you add tweetsharp to .NET Core project - that will throws exception in runtime, that can't find Newtonsoft.Json 9.0.0.0, because tweetsharp use 7.0.1 and copy it to output folder.
Upgrade Newtonsoft package to lastest Newtonsoft.Json version
I'm working on access to the Twitter Ads API - which lives on a different endpoint (https://ads-api.twitter.com). Unless I'm totally mistaken, that doesn't seem to fit into the current model where the endpoint is in Globals.
Do you have any suggestions on how to go about this and would you be interested in a PR for this when I'm done?
Great job on keeping this alive :-)
Hi,
is there a problem with UAP again? If i create a NEW App. Download only tweetmoasharp with nuget go to the "MainPage.xaml.cs" und use this function. The App never comes the line with "returnval = ....". So it looks like SearchAsync got a problem :/.
public static async Task<List<TwitterStatus>> GetTestTweets()
{
var returnval = new List<TwitterStatus>();
try
{
var service = new TwitterService(ConsumerKey, ConsumerSecret);
service.AuthenticateWith(AccessToken, AccessTokenSecret);
var results = await service.SearchAsync(new SearchOptions { Q = "#test", Count = 50 });
returnval = new List<TwitterStatus>(results.Value.Statuses);
}
catch (Exception exc)
{
System.Diagnostics.Debug.WriteLine(exc.Message);
}
return returnval;
}
The same code works very well on a normal WPF or Command Line-Application.
I cannot upload media and attach the mediaId with a tweet. It always return null for the uploadmedia method.
TwitterUser.ProfileImageUrl & TwitterUser.ProfileImageUrlHttps both provide links to low quality images, the simplest fix would be to remove "normal" from the end of the image url. (for example: "...qHMSV-MU_normal.jpg" should become: "...qHMSV-MU.jpg"
See https://dev.twitter.com/overview/general/user-profile-images-and-banners for details on profile avatar image sizing.
Hi community,
I was just wondering, why adding TweetMoaSharp to my C# project via NuGet also adds a reference to NUnit? Is this really necessary? I prefer to have production code and related unit tests in two different projects, so you can easily publish production code as NuGet package without a reference to unit test libraries.
Best Regards,
Mark
Support task based async overloads for auth methods (GetRequestToken etc).
Haven't found how to do so.
The Can_parse_multibyte_entities() unit test definitely shows that tweets with emoji can be read :), but how do I send one with an emoji in it?
Using the official Twitter API (https://github.com/twitter/twemoji), for example, I can replace the thumb up emoji with . I just haven't found how to send this html fragment with the tweetmoasharp library. Or is there an easier way?
Thanks!
This bug has been in Tweetsharp since way back. If you send someone a video via DM, it can't be deserialized properly, throws the error
Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'TweetSharp.TwitterDirectMessage' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.'
I've tried to use the 4.0 dll in a project where we have upgraded to 4.0 because a new dll requires Newtonsoft.json.dll with the latest 7.0 version.
Unfortunately that causes an error trying to use the released dll
System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
I've managed to get the sources and compile just the project that I need with the updated dll, but I think that it would be great if you could push a new release compatible with the 7.0 version.
Thank you.
bool Retweeted = tweet.IsRetweeted;
bool Favorited = tweet.IsFavorited;
these are always return 'false' though I did retweet.
is this incorrect use?
and how can i load mute list?
'TwitterService.ListMutedUsers' returns 'long' type unlike 'TwitterService.ListBlockedUsers'.
:)
sorry for my terrible English
Hi Yortw, thank you for the time in maintaining a really nice C#.net wrapper for C# developers.
I was trying to upload a video using service.UploadMedia(Options) where Options contained the stream of my video file. The function returned null. It works for Images but not for videos. Please advise.
If there's no video uploading api wrapper yet, then please consider this as a feature request.
Many thanks,
At first, thank you, to bring tweetsharp back to live.
We use TweetMoaSharp and it works great with windows, but we switched our infrastructure to linux docker.
Now, we have a problem with UploadMedia.
Twitter gives us an error back.
The stream content object is not correct.
The problem is the hammcock library, it uses to create the stream content object an StringBuilder. This StringBuilder use Environment.Newline to add new lines.
This Newlines are different between Windows and Linux.
I know this is a small issue, we have our workaround and .NET CORE is the new way to go. But i thought it is not a bad idea to report this issue.
The DeleteTweet functionality should use HTTP POST, not the DELETE method.
Just one field missing:
created_at => CreatedDate
The old DM API is deprecated and the migration guide suggest that:
Developers should migrate to the relative API endpoint as described below by August 16th, 2018.
This is a very significant rewrite of the DM API. Main changes to be aware of:
since_id
and max_id
Additionally, based on the documentation provided, I can't tell what events.message_create.message_data.entities.symbols
includes.
I've been trying for days to get the list of the direct messages that I have and it doesn't do anything,it works or is just deprecated ?
Thank you!
"Value was either too large or too small for an Int32."
The exception is happening for New Users on TwitterService > GetAccessToken Method !!!
I am simply trying to post a tweet using SendTweet method, but its Action method is not executing. I am not able to figure out the reason. I have no idea where to look for the response and error..
users/lookup provide profile_banner_url field to access profile banner path.
Will you add this field to TwitterUser class?
Using the WebForms demo calling await ctx.TweetAsync(UpdateTextBox.Text) with UpdateTextBox.Text = "æ test" + DateTime.Now; results in {"Bad Authentication data."}
A bug in my application surfaced when pulling in this tweet: https://twitter.com/BZTHEEZE/status/637228279825608706 with Emoji and what looks like a complete gibberish character.
I'm not sure if there's anything that can be done about this I'll describe the symptoms and then say what I think the issue may be. My experience with Unicode encodings isn't good enough to be sure.
This issue also appears in Tweetsharp 2.3.1.2-unofficial
First, TextAsHtml ends with the link https://t.co/W2TeREt0Hdt0Hd - the extra t0Hd at the end shouldn't be there.
Finally, when I include this string in an object which gets serialized to XML (an RSS feed), it complains that a high surrogate character must always be paired with a low surrogate character.
I would imagine the slightly skewed link is because the offsets in the entities returned by Twitter don't match the reality. It appears that source of the Tweet itself is damaged, as if it's sending UTF-16 bytes over the wire and declaring them as UTF-8 or something.
Serializing to Json, including the string in a website or my own API all work fine, the issue for me only surfaces when I try to serialize in XML. Therefore before I serialize the object, I run the text through these functions:
private static readonly Encoding Utf8Encoder = Encoding.GetEncoding(
"UTF-8",
new EncoderReplacementFallback(string.Empty),
new DecoderExceptionFallback());
private static string RepairStringEncoding(string str)
{
return Utf8Encoder.GetString(Utf8Encoder.GetBytes(str));
}
...which serializes without exceptions albeit with the extra characters in the link (t0Hd).
Thanks for reading, I'm curious to know your thoughts and whether you think such an issue should be addressed within TweetMoaSharp itself or by the applications that use it. And whether you think the Tweet is "damaged" or perhaps a bug in their API?
Thanks as always,
Steve
how can I answer the poll with Tweetsharp
Hi,
I've been trying to upload a gif image in a chunk based approach in the following way:
`var service = new TwitterService(_consumer_key, _consumer_secret);
service.AuthenticateWith(AccessToken, AccessTokenSecret);
var cMediares = await service.UploadMediaInitAsync(new UploadMediaInitOptions() { "image/gif", TotalBytes = 38656, MediaCategory = TwitterMediaCategory.AnimatedGif});`
But in response i'm getting an error, '32: "Could not authenticate you."' at service.UploadMediaInitAsync call.
Your kind help will be much appreciated.
Thanks.
There is an issue in the original TweetSharp repository that suggests some characters cause tweets to fail. This is specifically listed as a problem when the tweet includes media, but may just be an issue with the character encoding regardless of what else in the tweet. A sample message that causes the problem is;
"Hello à ...."
There is also a suggestion that the apostrophe character ' may cause similar issues. To quote the original issue;
After search, I have immediately error if message contains ' (quote) character such as " L'image ". If I try the message " L image ", tweet will be send with no error.
I'm putting together a test/example .NET Core app and am having issues using your library. When adding TweetMoaSharp from NuGet I get the following output from the Package Manager.
Package TweetMoaSharp 3.0.0.15 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package TweetMoaSharp 3.0.0.15 supports:
- net20 (.NETFramework,Version=v2.0)
- net35 (.NETFramework,Version=v3.5)
- net40 (.NETFramework,Version=v4.0)
- net45 (.NETFramework,Version=v4.5)
- portable-win81+wpa81 (.NETPortable,Version=v0.0,Profile=Profile32)
- sl4 (Silverlight,Version=v4.0)
- sl4-wp (Silverlight,Version=v4.0,Profile=WindowsPhone)
- sl4-wp71 (Silverlight,Version=v4.0,Profile=WindowsPhone71)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Any suggestions on how to get the library working properly in .NET Core 1.0 or are there dependencies that make it impossible?
From what I can tell, the different stages for chunked media upload endpoint are not implemented. More information on that here: https://dev.twitter.com/rest/reference/post/media/upload-init
With the current implementation, I cannot find a way to upload MP4 video files, as the normal media/upload endpoint is limited to only images. Is there a workaround?
Thanks!
It would be great if we could add two Lists API missing: 1) Ownerships (lists I own), and 2) members/create_all to add many members to a list at once.
I was trying to make these changes myself and send a PR, but I'm having a hard time with Hammock.
https://dev.twitter.com/rest/reference/post/lists/members/create_all
I believe Twitter implemented this after TweetSharp stopped being supported, so it probably doesn't work. We should implement this feature.
All is working well, it's just that Visual Studio keeps complaining about conflicts between different versions of the same dependent assembly.
Supposed to check help/configuration to know how many characters are available for shortening, I can't figure out how to access that via TweetSharp, so I'm estimating a few more than currently used.
However, when I pass the status with a longer URL, it should auto-shorten according to Twitter Dev, but I'm getting Error 186, too long.
Any advice for where to look?
Is it possible to specify any options with the filter. When I use this method the twitter endpoint is yelling at me: "No filter parameters found. Expect at least one parameter: follow track locations".
From: https://dev.twitter.com/rest/reference/post/lists/update
Enable lists to update title & description. I believe the right syntax for T4 is this:
TwitterList, "lists/update":POST, UpdateList, string owner_screen_name, long? owner_id, long? list_id, string slug, TwitterListMode? mode, string name, string description
Thank you.
I wanna make RT'ers extractor
Is any development being made in TweetMoaSharp to support fetching tweets longer than 140 characters ?(up to 280 characters, the current maximum)
There is already a ListMutedUserIds and ListMutedUsers should return user objects rather than ids to be consistent with the rest of the API. Although this would be a breaking change it seems worth while fixing.
Twitter have just added support for retweeting and quoting the original tweet as an embedded status, which saves characters in the retweet. We should find out what, if anything, is required to support this and implement it.
How come you have choosen to include the Hammock.ClientProfile assembly in the package?
Wouldn't it make more sense to declare it a dependency?
Hi -
This snippet crashes with a JSON error.
ListSuggestedUsersOptions opt = new ListSuggestedUsersOptions();
opt.Lang = "en";
var c = service.ListSuggestedUsers(opt);
Thank you!
hi
this is my code . i have no media entities for retweets . whats th problem . how can i fix it
var service = new TwitterService(_consumerKey, _consumerSecretKey); service.AuthenticateWith(_acessToken, _accessTokenSecret); //var currentTweets = service.ListTweetsOnSpecifiedUserTimeline(screenName: "screen name", page: 1, count: 100); var list = service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions() { ScreenName = "ali_persian999", });
how do i send an image in a direct message?
The ability to pull down a public timeline would be a welcome addition... and would solve a big problem for me particularly. I really only need it for GET statuses/user_timeline...
Hi, I have noticed a problem with TweetMoaSharp nuget package. I have installed it from nuget repo, it's working fine, but when I created an appx package of my Windows Phone 8.1 project, it can't pass tests form Windows App Certification Kit. The is a problem with Hammock.WinRT.dll because it is build in debug mode rather than release mode. Can you provide my a release version of Hammock.WinRT.dll or change it in nuget package?
Kacper
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.