Rishikant181 / Rettiwt-API

A CLI tool and an API for fetching data from Twitter for free!
https://rishikant181.github.io/Rettiwt-API/
MIT License
303 stars 31 forks source link

One or more validation errors occured. Check details #480

Closed xue160709 closed 4 months ago

xue160709 commented 4 months ago

Thank you for your open source project! Currently I am encountering a problem during use

const url = new URL("http://127.0.0.1:7890")
            const rettiwt = new Rettiwt({proxyUrl:url, logging: true});
            rettiwt.user.timeline("elonmusk").then(
                res => {
                    console.log(res);
                }
            ).catch(err => {
                console.log(err);
            })

image

The error message is like this, how should I solve it? Or is this a bug?

Rishikant181 commented 4 months ago

When fetching timeline, you give the id of the user as a parameter, not the username (the same is shown in the error details: `id must be a number string')

To get the id, fetch the details of the user first using user.details method. Then use the id from the details to fetch timeline.

xue160709 commented 4 months ago

When fetching timeline, you give the id of the user as a parameter, not the username (the same is shown in the error details: `id must be a number string')获取时间线时,您将用户的 id 作为参数提供,而不是用户名(错误详细信息中显示的内容相同:“id 必须是数字字符串”)

To get the id, fetch the details of the user first using user.details method. Then use the id from the details to fetch timeline.要获取 id,请首先使用 user.details 方法获取用户的详细信息。然后使用详细信息中的 id 来获取时间线。

Perfect solution! Thank you for your help, have a good day!