add home methods to docs

This commit is contained in:
Valentine 2024-07-09 05:37:43 +03:00
parent 58b161596d
commit d8caf71a12

View file

@ -24,6 +24,8 @@ You can use this library to get tweets, profiles, and trends trivially.
- [Get user tweets](#get-user-tweets)
- [Get user medias](#get-user-medias)
- [Get bookmarks](#get-bookmarks)
- [Get home tweets](#get-home-tweets)
- [Get foryou tweets](#get-foryou-tweets)
- [Search tweets](#search-tweets)
- [Search params](#search-params)
- [Get profile](#get-profile)
@ -266,6 +268,56 @@ var cursor string
tweets, cursor, err := scraper.FetchBookmarks(20, cursor)
```
### Get home tweets
> [!IMPORTANT]
> Requires authentication!
500 requests / 15 minutes
`GetHomeTweets` returns a channel with the specified number of latest home tweets. Its using the `FetchHomeTweets` method under the hood.
```golang
for tweet := range scraper.GetHomeTweets(context.Background(), 50) {
if tweet.Error != nil {
panic(tweet.Error)
}
fmt.Println(tweet.Text)
}
```
`FetchHomeTweets` returns latest home tweets and cursor for fetching the next page. Each request returns up to 20 tweets.
```golang
var cursor string
tweets, cursor, err := scraper.FetchHomeTweets(20, cursor)
```
### Get foryou tweets
> [!IMPORTANT]
> Requires authentication!
500 requests / 15 minutes
`GetForYouTweets` returns a channel with the specified number of for you home tweets. Its using the `FetchForYouTweets` method under the hood.
```golang
for tweet := range scraper.GetForYouTweets(context.Background(), 50) {
if tweet.Error != nil {
panic(tweet.Error)
}
fmt.Println(tweet.Text)
}
```
`FetchForYouTweets` returns for you home tweets and cursor for fetching the next page. Each request returns up to 20 tweets.
```golang
var cursor string
tweets, cursor, err := scraper.FetchForYouTweets(20, cursor)
```
### Search tweets
> [!IMPORTANT]