pionxzh / Pornhub.js

Powerful PornHub API for Node.js
MIT License
90 stars 19 forks source link

All videos are returning 404 #119

Closed cocapeanut closed 1 month ago

cocapeanut commented 1 month ago

I have quite a lot experience with m3u8 video players.

This is one sample of the mediaDefinitions

{
      defaultQuality: false,
      format: 'hls',
      videoUrl: 'https:\\/\\/ev-h.phncdn.com\\/hls\\/videos\\/202402\\/29\\/448865721\\/1080P_4000K_448865721.mp4\\/master.m3u8?validfrom=1722125821&validto=1722133021&ipa=157.52.253.244&hdl=-1&hash=vGqgR4ptHxTIEYJo78neNXy3aIQ%3D',
      quality: 1080,
      remote: false
    },
 Usually to be able to play this you need to add proxy in front of it like so

https:\example-proxy.com?url=https:\\/\\/ev-h.phncdn.com\\/hls\\/videos\\/202402\\/29\\/448865721\\/1080P_4000K_448865721.mp4\\/master.m3u8?validfrom=1722125821&validto=1722133021&ipa=157.52.253.244&hdl=-1&hash=vGqgR4ptHxTIEYJo78neNXy3aIQ%3D The cors error is gone but network error is saying 404. they cant be all returning 404 right? that means either the video is deleted or the m3u8 url is wrong. even vlc player which doest require cors cant play the m3u8 url

 you can try it yourself
 https://m3u8play.dev
pionxzh commented 1 month ago

This is because the videoUrl are not unescaped. You can use url.replace(/\\/g, '') to fix the URL. I will publish a new version with the fix.

cocapeanut commented 1 month ago

image

even after url.replace(/\\/g, '')

you can try it yourself https://m3u8play.dev

btw aside from cors-proxy im also using ip proxies

`import { PornHub } from "pornhub.js"; import { HttpsProxyAgent } from "https-proxy-agent";

export const proxies = [ { host: '207.244.217.165', port: 6712, username: 'cocapeanut', password: 'test' }, { host: '134.73.69.7', port: 5997, username: 'cocapeanut', password: 'test' }, { host: '64.64.118.149', port: 6732, username: 'cocapeanut', password: 'test' }, { host: '157.52.253.244', port: 6204, username: 'cocapeanut', password: 'test' }, { host: '167.160.180.203', port: 6754, username: 'cocapeanut', password: 'test' }, { host: '166.88.58.10', port: 5735, username: 'cocapeanut', password: 'test' }, { host: '173.0.9.70', port: 5653, username: 'cocapeanut', password: 'test' }, { host: '204.44.69.89', port: 6342, username: 'cocapeanut', password: 'test' }, { host: '173.0.9.209', port: 5792, username: 'cocapeanut', password: 'test' }, ];

export function getRandomProxy() { const randomIndex = Math.floor(Math.random() * proxies.length); const currentProxy = proxies[randomIndex]; console.log(Using proxy: ${currentProxy.host}:${currentProxy.port}); return currentProxy; }

export function getConfiguredPornHub() { const { host, port, username, password } = getRandomProxy(); const proxyUrl = http://${username}:${password}@${host}:${port}; const httpsAgent = new HttpsProxyAgent(proxyUrl); const pornhub = new PornHub(); pornhub.setAgent(httpsAgent); return pornhub; } `

not my real ip password.

pionxzh commented 1 month ago

Let me try the player you provided later. But it does work for me with PotPlayer.

pionxzh commented 1 month ago

That is because of the CORS issue. Try some local m3u8 player.