EchterAlsFake / PHUB

A lightweight API for Pornhub
https://phub.rtfd.io
GNU General Public License v3.0
76 stars 25 forks source link

[Feature] messaging users #60

Closed rlleshi closed 5 months ago

rlleshi commented 6 months ago

From what I can see from the docs & codebase, currently messaging other users is not supported.

Is this sth planned in the roadmap? Or is this sth not at all planned due to possible ethical concerns?

Egsagon commented 6 months ago

Hey,

This project does not have any roadmap as of now. Our personal goals being achieved (video downloading, web scraping, etc.), we did not plan to implement such features. I, personally, don't have the time nor the will to maintain this project right now. But i can still give you advices that are not in the docs (which btw, are a bit outdated).

While the feature you want is not directly implemented, you can still use the inner API call methods to achieve what you want. Here is as an example of how to post comment under a video. You can theorically adapt this function to achieve any interaction on PH. I don't think it would cause more ethical problems than the project already has (and i didn't even know there was pornhub DMs).

def comment(video: phub.Video, body: str) -> None:
    assert video.client.logged
    response = video.client.call(
        f'comment/add?id={video.id}&type=Video&vKey={video.key}&token={video.client._granted_token}',
        'POST',
        {'comment': body}
    )
    response.raise_for_status()

Keep in mind this code is old and might not have survived PH updates, and that the private PH API is a bit of a mess so you might have to find the right body, headers, tokens, etc. for the request to work. Good luck!

Also PHUB is open-source so if you feel like publishing your work, don't hesitate to make a PR :)
rlleshi commented 6 months ago

Great, ty for the tip!