මේ දවස්වල වැඩියෙන්ම AI සම්බන්දව වැඩ තමා කරන්නෙ. එහෙම වැඩ කරනකොට data set එකක් හදාගන්න x-rated python project එකක් සෙට් උනා. clientට ඕනෙ වෙලා තිබ්බෙ model එකක් train කරන්න dataset එකක් හදාගන්න. ඒ ගැන වැඩි විස්තරයක් කිව්වෙ නෑ. සමහරවිට uber realistic වගේ checkpoint එකක් වෙන්නත් පුලුවන්.
කොහොමහරි මේක web scraping project එකක්. clientට සම්පූර්ණ site එකම scrape කරගන්න උවමනාව තිබ්බෙ නෑ. අවශ්යතාවය තිබ්බෙ model කෙනෙක්ගෙ නමක් දුන්නාම ඒ modelගෙ නමින් තියෙන සම්පූර්ණ image gallery එකම download කරගන්න එක. full site scrape project එකක් නෙමේ. ඒ නිසා model ගෙ නමින් තියෙන gallery එක manual search කරල අරන් ඒ url එක තමා scrape කරන්න දෙන්න ඕනෙ.
project එක ඉවර උනාට පස්සෙ මේ codes කිසිම වැඩක් නැතිවෙනව. project එක කරල සෑහෙන දවසක්. මෙහෙම projects repeats වෙන්නෙත් නැතිම තරම්. ඒ නිසා ඔන්න මේකෙ ඉන්න එකෙක්ගෙ අතට හරි වැඩක් වෙයි කියල මේකෙ පෝස්ට් කරන්නෙ.
local pc එකෙත් පුලුවන් නැත්නම් cloud run එකක් කරන්න පුලුවන්. සයිට් ඔක්කොම 4ක් තියෙනව. duplicate photoset download වෙන්න පුලුවන්. clientට ඒක ප්රශ්නයක් උනේ නෑ කොහොමත් manual photos select කරන නිසා. difpy වගේ use කරල highest resolution photo එක තියාගෙන අනිත් duplicates අයින් කරගන්න පුලුවන්.
babe$ped!a
https://www.python.org/downloads/windows/
සාමාන්යෙන් request 2000ක් එක දිගට වැදුනත් cloudfare on වෙන්නෙ නෑ. request වැඩි උනා කියල ddos වෙන්නෙත් නෑ. human verification on වෙනව ip range එකකට. ඒ නිසා අනවශ්ය වැඩ කරන්න එපා තේරුමක් නෑ.
මේකත් එක්කම unplash, pixabay, pexels වගේ site වලටත් code එක modify කරගත්ත. lora model එකක් train කරද්දි regularization image data set එකක් හදාගන්න. cv2 & openpose වලින් auto crop කරගත්ත. claude කියල code එකක් ලියාගෙන focal point වලිනුත් crop කරගත්ත
කොහොමහරි මේක web scraping project එකක්. clientට සම්පූර්ණ site එකම scrape කරගන්න උවමනාව තිබ්බෙ නෑ. අවශ්යතාවය තිබ්බෙ model කෙනෙක්ගෙ නමක් දුන්නාම ඒ modelගෙ නමින් තියෙන සම්පූර්ණ image gallery එකම download කරගන්න එක. full site scrape project එකක් නෙමේ. ඒ නිසා model ගෙ නමින් තියෙන gallery එක manual search කරල අරන් ඒ url එක තමා scrape කරන්න දෙන්න ඕනෙ.
project එක ඉවර උනාට පස්සෙ මේ codes කිසිම වැඩක් නැතිවෙනව. project එක කරල සෑහෙන දවසක්. මෙහෙම projects repeats වෙන්නෙත් නැතිම තරම්. ඒ නිසා ඔන්න මේකෙ ඉන්න එකෙක්ගෙ අතට හරි වැඩක් වෙයි කියල මේකෙ පෝස්ට් කරන්නෙ.
local pc එකෙත් පුලුවන් නැත්නම් cloud run එකක් කරන්න පුලුවන්. සයිට් ඔක්කොම 4ක් තියෙනව. duplicate photoset download වෙන්න පුලුවන්. clientට ඒක ප්රශ්නයක් උනේ නෑ කොහොමත් manual photos select කරන නිසා. difpy වගේ use කරල highest resolution photo එක තියාගෙන අනිත් duplicates අයින් කරගන්න පුලුවන්.
babe$ped!a
Python:
import argparse
import os
from pathlib import Path
from urllib.parse import urljoin, urlparse
import requests
from bs4 import BeautifulSoup
from termcolor import colored
base_url = "https://www.babepedia.com"
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0"
def get_html_content(url):
# Create a dictionary for headers
headers = {"User-Agent": user_agent}
return requests.get(url, headers=headers).text
def create_directory(directory):
# Create Path object
path = Path(f'models/{directory}')
# Create the directory if it doesn't exist (including parents)
if not path.exists():
path.mkdir(parents=True)
print("Directory", directory, "created successfully!")
else:
print("Directory", directory, "already exists.")
def get_photo_set(model, url):
create_directory(model)
print(url)
response = get_html_content(url)
# print(response)
soup = BeautifulSoup(response, 'html.parser')
# print(soup)
tags = soup.findAll("div", class_="thumbshot")
# print(tags)
for tag in tags:
href_link = tag.find("a").get("href")
if "gallery" in href_link:
# print(href_link)
get_photos_from_set(model, href_link)
def get_photos_from_set(model, url):
url = base_url + url
print(url)
response = get_html_content(url)
# print(response)
soup = BeautifulSoup(response, 'html.parser')
# print(soup)
element = soup.find("div", id="gallery")
title = element.find("a").get("title").replace("\\", "")
# print(title)
tags = element.findAll("a", class_="img")
# print(tags)
for tag in tags:
href_link = tag.get("href")
# print(href_link)
download_photo(model, href_link, title)
def download_photo(model, url, title):
url = base_url + url
print(colored(url, "cyan"))
sub = f'{title}_{os.path.basename(urlparse(url).path)}'
file_name = f'models/{os.path.join(model, sub)}'
# print(file_name)
path = Path(file_name)
if path.exists():
return
# Download the image
headers = {"User-Agent": user_agent}
response = requests.get(url, headers=headers)
if response.status_code == 200:
with open(file_name, 'wb') as f:
f.write(response.content)
print(f"Downloaded: {file_name}")
else:
print(colored(f"Failed to download: {url}", "red"))
def main(model, url):
get_photo_set(model, url)
if __name__ == '__main__':
os.system('color')
parser = argparse.ArgumentParser(description="Download photos from given url")
parser.add_argument("-m", required=True, help="Enter model name")
parser.add_argument("-u", required=True, help="Enter valid url")
args = parser.parse_args()
print(colored(f'Model Name: {args.m}', 'green'))
print(colored(f'URL: {args.u}', 'green'))
main(args.m, args.u)
python
required python 3.6 or higherhttps://www.python.org/downloads/windows/
package installation
Bash:
pip install requests
pip install BeautifulSoup4
pip install argparse
pip install path
usage
Code:
python your_filename.py -m <model_name> -u <gallery_url>
example
Code:
python your_filename.py -m Ellie_Luna -u https://www[dot]babepedia[dot]com/babe/Ellie_Luna
සාමාන්යෙන් request 2000ක් එක දිගට වැදුනත් cloudfare on වෙන්නෙ නෑ. request වැඩි උනා කියල ddos වෙන්නෙත් නෑ. human verification on වෙනව ip range එකකට. ඒ නිසා අනවශ්ය වැඩ කරන්න එපා තේරුමක් නෑ.
මේකත් එක්කම unplash, pixabay, pexels වගේ site වලටත් code එක modify කරගත්ත. lora model එකක් train කරද්දි regularization image data set එකක් හදාගන්න. cv2 & openpose වලින් auto crop කරගත්ත. claude කියල code එකක් ලියාගෙන focal point වලිනුත් crop කරගත්ත