JustalK / PORNHUB-API

A powerful and complete scrapper for the very famous pornhub.com. This javascript module for node give you the possibility, through an API with many options, to scrap any information out of a page or the search page.
MIT License
130 stars 29 forks source link

[BUG] Download URLs return links with 403 status code #28

Closed North-West-Wind closed 3 years ago

North-West-Wind commented 3 years ago

Describe the bug The generated download_urls cannot be accessed. Putting that link into the browser returns a page with 403 http status code.

To Reproduce

    try {
      const video = await ph.page(link, ["title", "duration", "download_urls"]);
      if(video.error) throw new Error(video.error);
      return video;
    } catch(err) {
      console.error(err);
      return { error: err.message };
    }

The given link is this one

Here is the response of the code above:

{
    "title": "The Pornhub Intro Commuity but for 1 Hour",
    "duration": 3605,
    "download_urls": {
        "240P": "https://ev.phncdn.com/videos/201901/18/202398871/240P_400K_202398871.mp4?validfrom=1604496969&validto=1604504169&rate=500k&burst=3800k&ip=3.81.96.206&hash=iVDgjmtskEzzILVJ7SLuprtphGs%3D",
        "480P": "https://c1v-h.phncdn.com/hls/videos/201901/18/202398871/480P_2000K_202398871.mp4/master.m3u8?kLEWBjU4uaMWQF-1Z_jIeCC9MzYiRk6mvy1LIfuHszstYYZN7Heh3AFClCAVXK9SmNtiDB5DV1CbUh-nCFofhw1ye8I-R0jxPfPvMz0LNqnhQrwrk_ECxbaXtzX7RxsUbK4IVTVJfz9p5m_M0yHU5uurtCmDwjLUuPMmUkSdwUcKLEKS0GNLE7Tp3fK2d-QlSwk9PVrjm2crUBwIZA"
    }
}
JustalK commented 3 years ago

I noted your bug. I will look at it later.

It should be fixed by Nov. 6 2020

JustalK commented 3 years ago

Ok, I have looked into it. You might need to give me more informations. Which links are not working ? Both or only one of the two ?

On my side, the links generated are not returning 403. But I do have a problem.

Pornhub has a funny way of creating the downloads link. First, you have to assemble the download links in a certain way. And at the end, you will get multiple download links and you have to find the correct one for each resolution. And actually, for this video, I dont know why yet, I am not returning the correct one for the 480P. It might be some sort of a random somewhere.

But the 240P works fine for me. I am still looking at it, it seems more complex that I thought.

North-West-Wind commented 3 years ago

I just tested it on glitch. I used the same code to return the urls and then put them into request. And guess what, both url returns 200. I didn't log the object though.

AthallahDzaki commented 3 years ago

I Think You Need Display The Video

JustalK commented 3 years ago

Hello AthallahDzaki,

What do you mean by I Think You Need Display The Video ? Can you elaborate ?

This error is strange and I cannot really replicate it, so I am a bit stuck with it.

AthallahDzaki commented 3 years ago

You need download it localy then upload again, because pornhub has IP auth

JustalK commented 3 years ago

Fixed with #30

And I come back on what I did for adding support to node 15, node 14 and node 12.