Closed mevaldez01 closed 2 months ago
Hi,
What server functionality are you talking about? This repository is a python package.
Sorry i am still new to coding and knew i was way off. and ive been using chatgpt and i think it has its wires crossed it keeps telling me to build a server.py in my backend and add this code
from flask import Flask, jsonify from PHUB.src.phub.phub_api import Client # Adjust the import based on your package
app = Flask(name)
client = Client()
@app.route('/api/videos', methods=['GET']) def get_videos():
video = client.get_video("https://www.pornhub.com/view_video.php?viewkey=ph5e8f2607e13df")
# Create a JSON response with video data
video_data = {
"title": video.title,
"url": video.url,
"thumbnail": video.image.url,
"views": video.views,
}
return jsonify(video_data)
if name == 'main': app.run(debug=True)
this is the problem that vs code gives me
Import "PHUB.src.phub.phub_api" could not be resolved that's from the top of the code.
i know i am way off base i am just confused and im still so new that i took on too much and now i just have my head stuck up my butt. Ive read reread you documentation so many times. im missing so simple and now have just gotten so far off track that i dont know how to go back. i dont even understand how ask the question i need help with. sorry. thank you
No problem
That's an import error. ChatGPT made a guess, but it's wrong. It's even written at line 2 of your script: "Adjust the import based on your package". You just have to replace:
from PHUB.src.phub.phub_api import Client
to:
from phub import Client
i promise to leave you alone after this. this is just finally the last step in a very long process of building the site from scratch. and like really this is the 4th time i had cloned your repo into project. Basically anytime i tried to add example (1) from PHUB.src.phub.phub_api import Client example (2) from src.phub.phub_api import Client and with the one i showed you earlier and now with you perfect fix i am still getting the same error message only thing that changes is the name but its always import from "blank" cannot be resolved. so I had to have messed up something somewhere else. again i am so sorry to ask such open ended question. thank you for your help and i will find your donation link and make sure to leave you one. i work for the state so i dont make a killing just want to show appreciation for your help and for the access to the repo.
Va Import "phub" could not be resolved
Install the package first with pip install phub
, then run it using the appropriate python interpreter.
I really don't mind answering you, don't worry.
Hello I am reaching out and I feel pretty slow for having to do this publicly. I installed your repo and for the life of me I can not figure out the server functionality to get it to run. I thought it would be the python server.py command but no matter what directory I run it in nothing happens. What I am afraid of is, I am doing this completely wrong, but this is how we learn so please be kind. HA HA