Skip to content

Commit

Permalink
Minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphka committed Apr 14, 2024
1 parent d941c5f commit 665e166
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Kayo Souza",
"name": "insta-downloader",
"version": "3.3.2",
"version": "3.3.3",
"description": "An application to download content from Instagram",
"main": "src/index.js",
"scripts": {
Expand Down
13 changes: 9 additions & 4 deletions src/Downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,17 @@ export default class Downloader {
responseType: "json"
})

if(typeof response?.data === "object" && "user" in response.data.data){
const { user } = response.data.data
return user
if(typeof response?.data === "object"){
const { data } = response.data

if(data && "user" in data){
return data.user
}

throw new Error(`Failed to get user: ${username}`)
}

return null
throw new Error(`User not found: ${username}`)
}
/** @param {string} username */
async GetUserId(username){
Expand Down

0 comments on commit 665e166

Please sign in to comment.