Git Product home page Git Product logo

Comments (18)

pionxzh avatar pionxzh commented on August 25, 2024 1

@chocobearxo I need this
view-source:https://www.pornhub.com/video/search?search=ass

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024 1

@chocobearxo Can you verify this with 1.7.4?

Well I've tested it a lot now and the only function that still seems to have issues is randomVideo() but like stated in another issue regarding that, that's an issue on Pornhub's end, not the library, so in short; yeah I pretty much think 1.7.4 fixed the issues. ๐Ÿ˜„

For others, this can be easily fixed with a while loop if you wanna use that.

let res = await pornhub.randomVideo()

while (res.id === 'https://www.pornhub.com/') {
    res = await pornhub.randomVideo()
}
// Continue whatever you're doing

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

Seems this is the same issue as #71, and it works on my side.
I suspect you got a different DOM because of IP (Europe?) or AB Testing.

Can you paste the HTML you get on the search page here or send it to my email? So that I can analyze it.

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024

Seems this is the same issue as #71, and it works on my side. I suspect you got a different DOM because of IP (Europe?) or AB Testing.

Can you paste the HTML you get on the search page here or send it to my email? So that I can analyze it.

What do you mean the HTML I get?

{
  data: [],
  paging: { current: NaN, maxPage: NaN, isEnd: true },
  counting: { from: 0, to: 0, total: 0 }
}

Is all it returns. :)

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024

Oh, do you mean you want me to go to https://www.pornhub.com/ and send you the HTML in "inspect"?

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024

If so; pornhub.zip

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024

view-source_https___www.pornhub.com_video_search_search=ass.zip

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

I suspect your ph instance got a shadow ban or something. The HTML you gave me is correct. But I think the content you get when you call .searchVideo might be empty or some warning text.

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024

I suspect your ph instance got a shadow ban or something. The HTML you gave me is correct. But I think the content you get when you call .searchVideo might be empty or some warning text.

So? ๐Ÿ˜… Is it an issue in the library or?

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

I'm still figuring out what it can be. I will improve the logging and error detection in the library so that you can monitor what happened.

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

So it worked before, but not anymore recently? What is the current status?

from pornhub.js.

DummyYummy avatar DummyYummy commented on August 25, 2024

Guys, maybe I don't understand something, but you just ignore cookies inside buildRequest function. In the end request is always send with empty headers. I just had a problem that all requests return empty results because of age verification.

    buildRequest<U extends Record<string, any>, T>(method: 'get' | 'post' | 'post-form', url: string, data?: U): Promise<T> {
        const headers: HeadersInit = {}
        const opts: RequestInit = { method, headers }

        if (method === 'post') {
            headers['Content-Type'] = 'application/json'
            opts.body = JSON.stringify(data)
        }

        if (method === 'post-form') {
            // headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
            opts.method = 'post'
            if (data) opts.body = this.buildParams<U>(data)
        }

        return this.fetch(url, opts)
            .then(res => this.toJson(res) as T)
            .catch(err => Promise.reject(err))
    }

As soon as I added locally smth like this:

const headers = { cookie: Object.entries(this.getCookies()).map(pair =>${pair[0]}=${pair[1]}).join('; ')};

Everything started to work fine

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

Man ๐Ÿ˜ญ You are right. I can't believe this has been wrong for so long.

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

This request module is like shit ๐Ÿ˜… I will reimplement it sometime.

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

@DummyYummy @chocobearxo v1.7.1 released.
Let me know if it works.

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024

@DummyYummy @chocobearxo v1.7.1 released. Let me know if it works.

Seems like searchVideo() works, but video() still throws an error that I mentioned in #80

from pornhub.js.

pionxzh avatar pionxzh commented on August 25, 2024

@chocobearxo Can you verify this with 1.7.4?

from pornhub.js.

iced-queen avatar iced-queen commented on August 25, 2024

So now you can easily focus on the other issues/suggestions whenever you've got time for that. ๐Ÿ˜Š

from pornhub.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.