Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
imperatrona committed Jul 9, 2024
1 parent d81d7bb commit f359f66
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ You can use this library to get tweets, profiles, and trends trivially.
- [Get trends](#get-trends)
- [Get following](#get-following)
- [Get followers](#get-followers)
- [Create tweet](#create-tweet)
- [Delete tweet](#delete-tweet)
- [Create Retweet](#create-retweet)
- [Delete retweet](#delete-retweet)
- [Get scheduled tweets](#get-scheduled-tweets)
- [Create scheduled tweet](#create-scheduled-tweet)
- [Delete scheduled tweet](#delete-scheduled-tweet)
Expand Down Expand Up @@ -363,6 +367,65 @@ var cursor string
users, cursor, err := scraper.FetchFollowers("Support", 20, cursor)
```

### Create tweet

> [!IMPORTANT]
> Requires authentication!
```golang
tweet, err = scraper.CreateTweet(twitterscraper.NewTweet{
Text: "new tweet text",
Medias: nil,
})
```

To create tweet with medias, you need to upload media first. Up to 4 medias; jpg, mp4 and gif allowed.

```golang
var media *twitterscraper.Media
media, err = testScraper.UploadMedia("./photo.jpg")
if err != nil {
t.Error(err)
}
tweet, err = scraper.CreateTweet(twitterscraper.NewTweet{
Text: "new tweet text",
Medias: []*twitterscraper.Media{
media,
},
})
```

### Delete tweet

> [!IMPORTANT]
> Requires authentication!
```golang
err := testScraper.DeleteTweet("1810458885008105870");
```

### Create Retweet

> [!IMPORTANT]
> Requires authentication!
Returns retweet id, which is not the same as source tweet id.

```golang
retweetId, err := testScraper.CreateRetweet("1792634158977568997");
```

### Delete retweet

> [!IMPORTANT]
> Requires authentication!
To delete retweet use source tweet id instead retweet id.

```golang
err := testScraper.DeleteRetweet("1792634158977568997");
```

### Get scheduled tweets

> [!IMPORTANT]
Expand Down

0 comments on commit f359f66

Please sign in to comment.