Add fetching likes API request
This commit is contained in:
parent
c0366a0978
commit
1087809d63
@ -421,6 +421,13 @@ func (api API) GetGraphqlFeedFor(user_id UserID, cursor string) (APIV2Response,
|
|||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api API) GetLikesFor(user_id UserID, cursor string) (APIV2Response, error) {
|
||||||
|
var response APIV2Response
|
||||||
|
err := api.do_http("https://twitter.com/i/api/graphql/2Z6LYO4UTM4BnWjaNCod6g/Likes?variables=%7B%22userId%22%3A%22" + fmt.Sprint(user_id) + "%22%2C%22count%22%3A20%2C%22includePromotedContent%22%3Afalse%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withClientEventToken%22%3Afalse%2C%22withBirdwatchNotes%22%3Afalse%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22unified_cards_ad_metadata_container_dynamic_card_content_query_enabled%22%3Atrue%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Atrue%7D", cursor, &response)
|
||||||
|
return response, err
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resend the request to get more tweets if necessary
|
* Resend the request to get more tweets if necessary
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package scraper_test
|
package scraper_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"offline_twitter/scraper"
|
"offline_twitter/scraper"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -19,4 +20,9 @@ func TestAuthentication(t *testing.T) {
|
|||||||
assert.True(api.IsAuthenticated)
|
assert.True(api.IsAuthenticated)
|
||||||
assert.NotEqual(api.CSRFToken, "")
|
assert.NotEqual(api.CSRFToken, "")
|
||||||
|
|
||||||
|
response, err := api.GetLikesFor(1458284524761075714, "")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Println(response)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user