Kylart / Nyaapi

Non-official api to access Nyaa.si and Nyaa.pantsu.cat (search, upload,...)
MIT License
108 stars 17 forks source link

Fix undefined scrap error #25

Closed JasonCheungDev closed 2 years ago

JasonCheungDev commented 2 years ago

Handles an exceptional case when the download torrent file option is missing in a search.

Error

(node:157123) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'match' of undefined
    at Node.<anonymous> (.../node_modules/nyaapi/src/si/scrap.js:18:67)
    at LoadedCheerio.each (.../node_modules/cheerio/lib/api/traversing.js:480:26)
    ...

Reproduction Steps

let results = await si.search("Kidou Senshi Gundam", 75, {
    category: '1_2',
    sort: 'seeders',
    p: 1
})

For example above would generate: https://nyaa.si/?f=0&c=1_2&q=Kidou+Senshi+Gundam&s=seeders&o=desc With one of the entries missing the download option seen below: image

Kylart commented 1 year ago

Thanks, this is now part of the 2.4.4 version.