You can login to gain access to premium video. (if you own a premium account)
const result = await pornhub.login(account, password)
if (!result.success) {
// Invalid username or password
console.log(result.error)
}
/* do something after login */
// pornhub.logout()
You can set a custom agent
to achieve something like Proxy
.
For more information, please have a look at node-https-proxy-agent.
npm install https-proxy-agent --save
const HttpsProxyAgent = require('https-proxy-agent')
const proxy = 'https://xxx.xxx.xxx.xxx:xx'
const httpsAgent = new HttpsProxyAgent(proxy)
pornhub.setAgent(httpsAgent)
Check Page Parser for more information.
Check Search for more information.
This method is used to get the token for pornhub's internal API.
For now, this token is only used for autoComplete and searchModel.
This library will automatically get the token if you don't provide one.
(optional) You can cache this token to avoid frequent requests.
I'm not sure about the expiration time though.
const token = await pornhub.getToken()
// provide the token manually
const result = await pornhub.autoComplete('luna', { token })
You can use Route
to build the URL of any pages on pornhub.com.
Check Route for more information.