Skip to content

Commit

Permalink
fix(scraper): 🐛 only LOG if not 404, not only return
Browse files Browse the repository at this point in the history
  • Loading branch information
djdembeck committed Sep 20, 2021
1 parent f3959b7 commit ae64436
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/helpers/audibleScrape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ class ScrapeHelper {
*/
async fetchBook (): Promise<cheerio.CheerioAPI | undefined> {
const response = await fetch(this.reqUrl)
if (!response.ok && response.status !== 404) {
if (!response.ok) {
const message = `An error has occured while scraping HTML ${response.status}: ${this.reqUrl}`
console.log(message)
if (response.status !== 404) {
console.log(message)
}
return undefined
} else {
const text = await response.text()
Expand Down

0 comments on commit ae64436

Please sign in to comment.