dijs / wiki

Wikipedia Interface for Node.js
MIT License
315 stars 61 forks source link

Include article url in most viewed list #165

Open dlinx opened 2 years ago

dlinx commented 2 years ago

I tried most viewed function, it returned an Array of title and viewCount. I sent the title of returned value, and got the error No article found. I think it is better to send the wiki link along with title and viewCount

dijs commented 2 years ago

Could you please provide an example with code and expected/actual results?

dijs commented 2 years ago

I think you are running into the issue of looking up Special pages in Wikipedia.

I tried the same thing and it works just fine.

wiki()
            .mostViewed()
            .then(data => {
                const title = data[2].title;

                return wiki()
                    .page(title)
                    .then(pg =>
                        pg.info().then(info => {
                            info.birthPlace.should.equal('Manhattan');
                            info.name.should.equal('Ronnie Spector');
                        })
                    );
            });