by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 23 23:25

    linvi on 6.0

    #1066 Created first v2 client a… (compare)

  • Sep 21 23:41
    linvi edited #1066
  • Sep 21 23:41
    linvi edited #1066
  • Sep 21 23:41
    linvi edited #1066
  • Sep 21 23:34
    linvi edited #1066
  • Sep 21 23:13
    linvi closed #723
  • Sep 21 23:12

    linvi on 6.0

    #1066 Initial support for Tweet… (compare)

  • Sep 21 23:09
    linvi milestoned #1066
  • Sep 21 23:09
    linvi assigned #1066
  • Sep 21 23:09
    linvi labeled #1066
  • Sep 21 23:09
    linvi opened #1066
  • Sep 21 23:08
    linvi milestoned #1064
  • Sep 20 22:39

    linvi on 6.0

    Renamed TwitterClient to Twitte… (compare)

  • Sep 19 22:57

    linvi on 6.0

    (compare)

  • Sep 19 22:51

    linvi on master

    [doc] Minor doc changes (compare)

  • Sep 19 22:42

    linvi on master

    Tweetinvi 5.0.0 go in beta stage (compare)

  • Sep 19 22:40

    linvi on master

    [doc] Added missing docs for li… (compare)

  • Sep 19 15:20
    linvi closed #1030
  • Sep 19 15:19

    linvi on master

    #1030 Tweetinvi is now using Da… (compare)

  • Sep 19 01:12
    linvi reopened #1063
linvi
@linvi
@GodsWithin I need to get back to it. I stopped because of the job and didn't really had time to finish it. So it is stale at the moment but I will do my best to resume it soon.
linvi
@linvi

Hi there, I wanted to keep you posted, specially @GodsWithin who has been requested some updates.

You will be happy to hear that the documentation of Tweetinvi 5.0 is now complete.
Next step is to clean up the bugs opened in the alpha and the beta release should come out.

I have also release an alpha-8 that fixed 2 bugs :)

Cheers,
Linvi

GodsWithin
@GodsWithin
Thank you for your work linvi, I look forward to eventually updating to 5.0 as it seems very promising.
Milan Gupta
@milangupta1
Excellent news Linvi. I just upgraded to the 5.0 alpha version as a first step for migrating to the twitter 2.0 apis.
linvi
@linvi
Tweetinvi 5.0 beta is now released. All code changes have been completed.
Beta is only to ensure stability and if no bug happen until next week, Tweetinvi 5.0 will be released.
Eric Vander Wal
@dumbgamedev
@linvi , what sort of things need to be done to make this stable for the new twitter API v2? It looks like V1 will be depreciated in Oct?
linvi
@linvi
@dumbgamedev Hi there. Could you share the post reporting the deprecation of API v1.1?

@dumbgamedev Ideally I want to use the OpenAPI to generate the models. Though the open API is currently not properly generating the models in csharp. Feel free to upvote my request of fix here :
OpenAPITools/openapi-generator#7458

Additionally, I want to mention that I have quite limited amount of time to work on this and will likely not be able to meet an october deadline.
In the meantime, developers will likely have to use the https://linvi.github.io/tweetinvi/dist/more/twitter-labs.html

Otherwise if any of you do have time to help in the development of Tweetinvi, now is a perfect time.
linvi
@linvi
@dumbgamedev I looked a bit more into it and I think I should be able to provide some support in October :)
linvi
@linvi
For october there will be only access to DTOs and not Models.
Models would require extra work that wouldn't be feasible in the time required.
Eric Vander Wal
@dumbgamedev
@linvi , thank you for the reply. I couldnt find where it said Oct again. So I posted on the twitter dev forum for details. But I havent gotten a reply yet.
It seems like there is not yet full coverage for v2 yet, so it seems crazy they are starting to depreciate things already.
Eric Vander Wal
@dumbgamedev
I appreciate you looking into it.
I see there is one other .net package supporting v2 at the moment, using DTOs : https://github.com/dumbgamedev/SocialOpinion-Public
Eric Vander Wal
@dumbgamedev
Right, here is where I found it (although you already know): https://developer.twitter.com/en/docs/labs/tweet-metrics/api-reference/get-tweets-metrics
Eric Vander Wal
@dumbgamedev
I have only been a .net dev for a few years, so please feel free to correct me. But it looks like the only way to implement v2, is with breaking changes to tweetinvi v5.
linvi
@linvi

@dumbgamedev Thanks for sharing this post.

I see there is one other .net package supporting v2 at the moment, using DTOs : https://github.com/dumbgamedev/SocialOpinion-Public

For the first release I was thinking of offering something similar, reusing the Tweetinvi and creating a TwitterClientV2 or something similar.
It means no support for special cases, computing/aggregating data for the users etc... Only access to pure DTO objects.

I have only been a .net dev for a few years, so please feel free to correct me. But it looks like the only way to implement v2, is with breaking changes to tweetinvi v5.

No breaking changes, only new DTO to implement, adding support for the new type of parameters and the simple stack to create the request.
I already started to create the UserDTO and TweetDTO for V2 yesterday. I have finished the first one and I will finish the TweetDTO tonight.

You will be able to track progress on the 6.0 branch.

Jamie Maguire
@jamie_maguire1_twitter
Hi @dumbgamedev . I am the author of the Social Opinion SDK :) If you have any questions then I'm happy to answer.
Eric Vander Wal
@dumbgamedev
@jamie_maguire1_twitter , thanks. I was actually going to ping you on twitter later, just to connect.
Jamie Maguire
@jamie_maguire1_twitter
@dumbgamedev - sure. Go for it. I' couldnt find a v2 SDK so built my own.
linvi
@linvi
@jamie_maguire1_twitter I think we are going to build the exact same thing. Are you willing to partner on this together?
linvi
@linvi
@dumbgamedev As promised, you can access V2 Tweets and Users endpoints with 6.0 as explained in linvi/tweetinvi#1066.
I will improve the support in the coming days, specially to provide an api style so that developers to not have to enter the url but also provide helpers to add the parameters.
GodsWithin
@GodsWithin
Anyone having irregular upload media behaviour? In particular using the binary upload from version 4.x?
Sometimes the media is processed fine, other time it returns a "blank" media object, all booleans false, all other properties null
linvi
@linvi
I never experienced this before. Is it something that started recently?
GodsWithin
@GodsWithin
Yes, very recently
GodsWithin
@GodsWithin
@linvi I checked, it looked like my app was forcefully put in a read-only state by Twitter
GodsWithin
@GodsWithin
I sent in a ticket :/
linvi
@linvi
Thanks for the feedback, let us know what happened!
GodsWithin
@GodsWithin
@linvi Also just wondering about this, does 5.x bring any performance improvements over 4.x? Or better usability in general?
linvi
@linvi
Performance, reliability and usability.
:O
(this is not marketing ;)
GodsWithin
@GodsWithin
Idk lol I've liked 4.x for as long as I've used it
Just that my streams trigger on RTs by accounts not part of the stream tends to be a bit annoying
I can really see my raspberry pi heating up w/e a big account tweets and they get several 1,000s of RTs in the first few minutes lol
Ooh I'd like to ask about this
Does 5.x implement any way to "measure" a string for their "tweet length"
I've my own custom thing doing that rn but yeah, if it's in the lib that would be easier
linvi
@linvi

Does 5.x implement any way to "measure" a string for their "tweet length"

No. Measuring the length of a tweet is extremely painful. The different criteria to take into consideration is very high and Twitter own logic do not respect their own rules.
Twitter do have an official logic on github here : https://github.com/twitter/twitter-text.

If you have time to reproduce their logic, I will be more than happy to integrate it to Tweetinvi. Personally, I won't have the bandwidth to do so.

GodsWithin
@GodsWithin
I only did some basic stuff like using a regex to capture URLs & Emojis because those have fixed lengths
I do know the url regex is insufficient because it doesn't support all TLDs, although that could easily be added
public static int EstimatedTweetLength(this string text)
{
    int estimatedLength = 0;

    var matches = emojiRegex.Matches(text);
    foreach (var match in matches)
        text = text.Replace(match.ToString(), string.Empty);

    var urlMatches = urlRegex.Matches(text);
    foreach (var match in urlMatches)
        text = text.Replace(match.ToString(), string.Empty);

    text = text.Normalize(NormalizationForm.FormC);

    int[] codePoints = ToCodePoints(text);
    foreach (int c in codePoints)
        estimatedLength += GetCodePointValue(c);

    return estimatedLength + matches.Count * 2 + urlMatches.Count * 23;
}
It has been working for months now and I haven't had a problem with it. That said, I'm only one user and my app only tweets in specific formats.
the other methods used:
private static int[] ToCodePoints(string str)
{
    if (str == null)
        throw new ArgumentNullException("str");

    var codePoints = new List<int>(str.Length);
    for (int i = 0; i < str.Length; i++)
    {
        codePoints.Add(char.ConvertToUtf32(str, i));
        if (char.IsHighSurrogate(str[i]))
            i += 1;
    }

    return codePoints.ToArray();
}

private static int GetCodePointValue(int codePoint)
{
    return ((codePoint >= 0 && codePoint <= 4351)
          || (codePoint >= 8192 && codePoint <= 8205)
          || (codePoint >= 8208 && codePoint <= 8223)
          || (codePoint >= 8242 && codePoint <= 8247)) ? 1 : 2;
}
linvi
@linvi

Thanks fo sharing, you can have a look at : linvi/tweetinvi@90c8936
Which was the last implementation supported by Tweetinvi.

My advice at that stage is to have a node server running on the physical server as your service and make an http request to that server.
I guess TLDs is one thing but again verify Twitter implementation as in the past they were not supporting them all.

Please feel free to open a pull request and you can use the set of tests that were checking the validity in the past.

https://github.com/linvi/tweetinvi/blob/4.0/Testinvi/Tweetinvi.Core/StringExtensionsTests.cs

GodsWithin
@GodsWithin
Looks like this is rather old haha
I don't recall media having an affect on tweet length
linvi
@linvi
Yes many crazy cases right ^^