Last active
August 13, 2025 01:58
-
-
Save phoenixthrush/f779a440a783f1d30756a3cac2d51553 to your computer and use it in GitHub Desktop.
Python mass downloader for pimpbunny.com #pimpbunny.com #Scraper #Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| MIT License | |
| Copyright (c) 2025 phoenixthrush | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all | |
| copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| SOFTWARE. | |
| """ | |
| import os | |
| import re | |
| from urllib.parse import urlparse | |
| import requests | |
| import tqdm | |
| from bs4 import BeautifulSoup | |
| URL = "https://pimpbunny.com/onlyfans-models/mollyredwolf/" | |
| def sanitize(name): | |
| return re.sub(r'[<>:"/\\|?*\x00-\x1F]', "_", name).strip(". ") | |
| def get_soup(url): | |
| r = requests.get(url, timeout=10) | |
| r.raise_for_status() | |
| return BeautifulSoup(r.text, "html.parser") | |
| base_url = urlparse(URL).scheme + "://" + urlparse(URL).netloc | |
| try: | |
| soup = get_soup(URL) | |
| count_tag = soup.select_one("span.pb-videos-count") | |
| total = int(count_tag.get_text(strip=True)) if count_tag else 999999 | |
| except: | |
| total = 999999 | |
| try: | |
| soup = get_soup(f"{URL}?videos_per_page={total}") | |
| links = {a["href"] for a in soup.select(f'a[href^="{base_url}/videos/"]')} | |
| for i, link in enumerate(links, 1): | |
| try: | |
| s = get_soup(link) | |
| a = s.select_one( | |
| f'a[href^="{base_url}/get_file/"][href*="download="]' | |
| ) | |
| if not a: | |
| continue | |
| title_tag = s.select_one("h1.pb-video-title") | |
| title = title_tag.get_text(strip=True) if title_tag else f"out_{i}" | |
| model_tag = s.select_one("span.pb-item-title.pb-heading-h3") | |
| model = model_tag.get_text(strip=True) if model_tag else "Output" | |
| filename = os.path.join(sanitize(model), sanitize(title) + ".mp4") | |
| os.makedirs(os.path.dirname(filename), exist_ok=True) | |
| print(f"{i}/{len(links)}: {title}") | |
| # subprocess.run( | |
| # ["ffmpeg", "-i", a["href"], "-c", "copy", filename], | |
| # stdout=subprocess.DEVNULL, | |
| # stderr=subprocess.DEVNULL, | |
| # ) | |
| video_url = a["href"] | |
| response = requests.get(video_url, stream=True, timeout=30) | |
| response.raise_for_status() | |
| total_size = int(response.headers.get("content-length", 0)) | |
| with open(filename, "wb") as f, tqdm.tqdm( | |
| total=total_size, unit="B", unit_scale=True, desc="Downloading", leave=False | |
| ) as pbar: | |
| for chunk in response.iter_content(chunk_size=8192): | |
| if chunk: | |
| f.write(chunk) | |
| pbar.update(len(chunk)) | |
| except KeyboardInterrupt: | |
| print("\nInterrupted.") | |
| exit() | |
| except: | |
| continue | |
| except KeyboardInterrupt: | |
| print("\nInterrupted.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment