A .NET library that fetch the user's Like timeline, Home timeline (For you) and Latest home timeline (Following) from Twitter's graphql API, and convert them to a bunch of Tweet objects that contain the contet, attached image and video, post date and such. The screenshot below is the example of an returned object.

The usage of this library? You can have a look at the sample folder, it contains 2 possible use cases of the library:
- Download every media you "liked" on Twitter, or;
- Forward every "liked" tweet to a Telegram channel.
Just be creative and you should be able to make it a even better use :)
Please note that this library use Regex to parse the content of the returned JSON. It provides a bit better performance than parsing it as a whole JSON object. However, a sightly bit change to the JSON format may make the library unusable.
I planned to rewrite it with some JSON library in the future.
Just add the source code of the library, and use the library as one of the reference of your project should do the job. Or just refer the built .DLL file in your project.
- Refer the library in your project by following the Installation section.
- Create a
TwitterLikeParserobject, remember to supply the necessary values to the constructor:timelineType- The timeline you want to fetch. It's aTimelineTypeenum value.twitterId- The twitter ID (the number) of someone, not to confuse with the handle of a Twitter usercookie- The cookie on the Twitter website. You should be able to get it by using F12 Devtool of any browser. It's how this library doesn't require user to logincsrt- The CSRT token of the user, you can also get it by using F12 Devtool of any browser.resultCount- The maximum number of result you want the API to return once.
- Call
NextPage()to start getting the first page of the timeline. If the values supplied to the constructor are correct, it should return an array ofTweetobject. - Keep calling
NextPage()to get the second page and so on, until it returnfalse, indicating that no more page is available.
A simple example call would be:
TwitterLikeParser likeList = new TwitterLikeParser(TimelineType.LikeTimeline, twitter_id, cookie, csrt, 20);
while (parser.NextPage())
{
foreach (Tweet tweet in parser.Tweets)
{
// Have fun with the Tweet object
}
}The Tweet and Media objects contains the following fields:
public class Tweet
{
public String Author { get; set; }
public String TweetId { get; set; }
public String Content { get; set; }
public String CreateDate { get; set; }
public String TweetUrl { get; set; }
public Media[] Medias { get; set; }
public String MediaJoined { get; set; }
}
public class Media
{
// "photo" and "video"
public String MediaType { get; set; }
public String Url { get; set; }
}