Closed arugaz closed 3 years ago
sometimes it works, sometimes it doesn't work
Hello,
You made me notice that the url return was not correct. So I fixed it.
You can now remove the replace //com
to /com
You also made me discover a bug, when there is no result for pornstars by example. My code was trying to sanitize a data that odes not exist. So I fixed that too.
Now, your code should work. I added your code to my unit test.
const result = await m.search('japan', ['title', 'link', 'premium', 'hd']);
const url = result.results[1].link;
const page = await m.page(url, ['title', 'pornstars', 'download_urls']);
Hello,
You made me notice that the url return was not correct. So I fixed it. You can now remove the replace
//com
to/com
You also made me discover a bug, when there is no result for pornstars by example. My code was trying to sanitize a data that odes not exist. So I fixed that too.
Now, your code should work. I added your code to my unit test.
const result = await m.search('japan', ['title', 'link', 'premium', 'hd']); const url = result.results[1].link; const page = await m.page(url, ['title', 'pornstars', 'download_urls']);
thank you very much, i will ask again if there is a problem
const pornhub = require('@justalk/pornhub-api'); const searchs = 'japan' pornhub.search(searchs,["title","link","premium","hd"]).then((result) => { const url = result.results[1].link.replace('.com//','.com/') console.log(url) pornhub.page(url, ["title","pornstars","download_urls"]).then((res) => { console.log(res) }) })
https://www.pornhub.com/view_video.php?viewkey=ph5f2469605d618 { error: 'An error occured' }
can not be in another link? but when searchs is 'Aa' it doesn't display an error