Closed arugaz closed 3 years ago
Sorry, I did not see your message earlier. I have taken note of the bug.
I will check tomorrow and hopefully, it will be fixed by October 24 2020 ;)
Ok, I got a bit curious since travis did not update me for telling me there is a bug in the API. So actually, the error you are facing is not due to the API but the way you use it. Maybe I did not explain it well in the documentation. I will work on that when I have time.
So the problem is the search
functions return an array of objet. Not a single object, so your code should be if you wanna get the title of the first video :
const pornhub = require('@justalk/pornhub-api');
const video = pornhub.search("Aa",["title","link","premium","hd"]);
console.log(video[0].title)
You should try the console.log
on the response from the api ;)
const pornhub = require('@justalk/pornhub-api');
const results = pornhub.search("Aa",["title","link","premium","hd"]);
console.log(results)
Tell me if any other questions or problem. I am often on github
Ok, I got a bit curious since travis did not update me for telling me there is a bug in the API. So actually, the error you are facing is not due to the API but the way you use it. Maybe I did not explain it well in the documentation. I will work on that when I have time.
So the problem is the
search
functions return an array of objet. Not a single object, so your code should be if you wanna get the title of the first video :const pornhub = require('@justalk/pornhub-api'); const video = pornhub.search("Aa",["title","link","premium","hd"]); console.log(video[0].title)
You should try the
console.log
on the response from the api ;)const pornhub = require('@justalk/pornhub-api'); const results = pornhub.search("Aa",["title","link","premium","hd"]); console.log(results)
Tell me if any other questions or problem. I am often on github
i did but i got promise pending
Ok, I got a bit curious since travis did not update me for telling me there is a bug in the API. So actually, the error you are facing is not due to the API but the way you use it. Maybe I did not explain it well in the documentation. I will work on that when I have time. So the problem is the
search
functions return an array of objet. Not a single object, so your code should be if you wanna get the title of the first video :const pornhub = require('@justalk/pornhub-api'); const video = pornhub.search("Aa",["title","link","premium","hd"]); console.log(video[0].title)
You should try the
console.log
on the response from the api ;)const pornhub = require('@justalk/pornhub-api'); const results = pornhub.search("Aa",["title","link","premium","hd"]); console.log(results)
Tell me if any other questions or problem. I am often on github
i did but i got promise pending
nvm i got a solution, thank you very much for your time
When you have a promise, use the await
;)
Like this :
async () => {
const pornhub = require('@justalk/pornhub-api');
const results = await pornhub.search("Aa",["title","link","premium","hd"]);
console.log(results)
}
const pornhub = require('@justalk/pornhub-api'); const video = pornhub.search("Aa",["title","link","premium","hd"]); console.log(video.title)
i got undefinied