Add back in the GetUserByID unauthenticated operation since apparently it does actually work

This commit is contained in:
Alessio 2024-11-06 18:58:18 -08:00
parent 2b7a636720
commit c7a6b5b321
3 changed files with 11 additions and 2 deletions

View File

@ -285,7 +285,7 @@ func create_profile(target_dir string) {
}
func _fetch_user_by_id(id scraper.UserID) error {
user, err := api.GetUserByID(id)
user, err := scraper.GetUserByID(id)
if errors.Is(err, scraper.ErrDoesntExist) {
// Mark them as deleted.
// Handle and display name won't be updated if the user exists.

View File

@ -22,7 +22,7 @@ func (p Profile) SaveTweetTrove(trove TweetTrove, should_download bool, api *API
"Conflicting user handle found (ID %d); old user has been marked deleted. Rescraping them\n",
conflict_err.ConflictingUserID,
)
user, err := api.GetUserByID(conflict_err.ConflictingUserID)
user, err := GetUserByID(conflict_err.ConflictingUserID)
if errors.Is(err, ErrDoesntExist) {
// Mark them as deleted.
// Handle and display name won't be updated if the user exists.

View File

@ -173,6 +173,15 @@ func ParseSingleUser(apiUser APIUser) (ret User, err error) {
return
}
// Calls API#GetUserByID and returns the parsed result
func GetUserByID(u_id UserID) (User, error) {
session, err := NewGuestSession() // This endpoint works better if you're not logged in
if err != nil {
return User{}, err
}
return session.GetUserByID(u_id)
}
/**
* Make a filename for the profile image, that hopefully won't clobber other ones
*/