Yes, you heard that right!
I know it's not legal, but it's for educational purposes, so try your own ricks.
Adult website like Porn hub is
a hot topic among today’s generation. There are hardly 1% of people who
haven’t heard of fascinating adult websites as there are ample options
available on the internet.
In this blog, we will help you
discover everything about adult website development with low
maintenance. So, whether you are into a similar business or planning to
start your own adult website, this blog can be your savior. Let’s
discover ‘How to build a website like x hamster?’ with step-by-step process.
Scrapflix Project Tutorial
Overview
🎥📽️✨ Scrapflix is a Flask-based web scraping project that allows users to search for video content related to specific actresses. The data is scraped dynamically from a specified website and displayed in a user-friendly format using HTML cards.
This tutorial will guide you through the steps to set up the project, understand the code, and run the application locally. 🎬✨🖥️
Project Structure
The project is organized as follows:
project-scrapflix
├───app.py
├───static
│ └───css
│ └───style.css
└───templates
├───index.html
└───results.html
Step 1: Set Up the Environment
-
Install Python: Ensure you have Python installed (version 3.7 or later). 🐍💻⚙️
python --version
-
Create a Virtual Environment: 🌐📁🚀
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install Required Libraries: 🛠️📦🖥️
pip install flask requests beautifulsoup4
Step 2: Understanding the Code
app.py
This is the main application file that sets up the Flask routes and handles data scraping. 📝📡🖥️
Key Components:
-
Imports: 📚🖋️✨
from flask import Flask, render_template, request import requests from bs4 import BeautifulSoup
These imports are necessary for setting up the Flask app and performing web scraping.
-
Scraping Function: 🕸️🔍📊
def scrape_data(actress_name): url = f"https://www.superporn.com/search?q={actress_name}/" headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0"} response = requests.get(url, headers=headers) if response.status_code != 200: return [] soup = BeautifulSoup(response.content, "html.parser") video_items = soup.select(".listado-videos .thumb-video a") data_list = [] for item in video_items: href = item.get("href") duration_tag = item.find("span", class_="duracion") img_tag = item.find("img") img_src = img_tag.get("data-src") or img_tag.get("src") if img_tag else None title = img_tag.get("alt") if img_tag else "No title found" duration = duration_tag.text.strip() if duration_tag else "N/A" if img_src and img_src.startswith("//"): img_src = "https:" + img_src if title and href and img_src and duration: data_list.append({ "title": title, "mainurl": href, "img": img_src, "duration": duration, }) return data_list
This function fetches video data based on the actress name provided by the user and extracts relevant information. 🔍🖼️🎞️
-
Flask Routes: 🌐🛤️📜
@app.route('/') def index(): return render_template('index.html') @app.route('/search', methods=['GET']) def search(): actress_name = request.args.get('actress_name', '').strip() page = int(request.args.get('page', 1)) if not actress_name: return render_template('index.html', error="Please enter an actress name.") scraped_data = scrape_data(actress_name) posts_per_page = 10 start = (page - 1) * posts_per_page end = start + posts_per_page paginated_data = scraped_data[start:end] total_pages = (len(scraped_data) + posts_per_page - 1) // posts_per_page return render_template('results.html', data=paginated_data, actress_name=actress_name, page=page, total_pages=total_pages) if __name__ == '__main__': app.run(debug=True)
These routes define the main search interface and display the search results. 🔄💾💻
Templates
-
index.html: 📝🖥️💡
<h1>Scrapflix</h1> <form action="/search" method="get" class="coolinput"> <label for="actress_name" class="text">SEARCH</label> <input type="text" class="input" id="actress_name" name="actress_name" placeholder="Search here..." required> <button type="submit" class="search-btn">Search</button> </form>
This page provides a simple search form for users to input the actress name. 🔎✨📲
-
results.html: 🖥️🎥📄
<h1>Results for "{{ actress_name }}"</h1> <div class="container"> {% for entry in data %} <div class="card"> <img src="{{ entry.img }}" alt="{{ entry.title }}"> <div class="card__content"> <p class="card__title">{{ entry.duration }}</p> <p class="card__description">{{ entry.title }}</p> <a href="{{ entry.mainurl }}" target="_blank">Watch Now</a> </div> </div> {% endfor %} </div>
This page displays the search results as cards and includes pagination functionality. 📜🔄🖼️
CSS Styling
- style.css: 🎨💻✨
This file styles the form, cards, and pagination elements for a polished user interface. 🎨💾🖥️.coolinput { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 50vh; } .container { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; } .card { width: 300px; height: 200px; background: linear-gradient(-45deg, #e30090 0%, #5502da 100%); border-radius: 10px; transition: all 0.6s cubic-bezier(0.23, 1, 0.320, 1); } .pagination { display: flex; justify-content: center; gap: 15px; margin-top: 40px; }
Step 3: Run the Application
-
Start the Flask Server: 🖥️🚀🛠️
python app.py
-
Access the Application: 🖥️🌐🖱️
Open a web browser and navigate tohttp://127.0.0.1:5000/
. -
Search for Videos: 🔍🎞️📲
Enter an actress name to search and browse the results.
Conclusion
This tutorial demonstrated how to set up and run the Scrapflix project, leveraging Flask and BeautifulSoup for web scraping and displaying results in a visually appealing way. 🎬🖥️✨ Happy coding! 🎉🚀💻