Phub

Latest version: v4.7.2

Safety actively analyzes 681881 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 9

4.1.1

Download improvements and refactors

- Refactored quality select dictionnary creation
- Refactored feed parsing regexes
- Added a function to reset the client session, thus allowing to refresh everything without having to initialise a new client in case of errors.
- Made default download display write a newline after download completion
- Thread downloader now has the ability to disable client request delay while downloading (enabled by default)
- Thread downloader now mounts a special https requests adapter while downloading to increase the urllib connection pool size by the amount of max workers
- Thread downloader now creates a new futures dict for each retry iteration (was very slow with futures being canceled for some reason)
- Better thread downloader logging
- Removed thread_FFMPEG downloader as threaded downloader is barely faster than FFMPEG so it makes no sense
- Refactored the way videos decide which title to fetch
- Better logo
- Updated logo image on PyPI
- Updated docs

4.1

Fixes a bunch of bugs and improves a few features.

Fixes
- Fixed JQuery and HQuery taking wrong parameters
- Fixed Feed type parsing being messy
- Fixed video title fetched to time at initialisation
- Fixed categories not able to reverse
- Fixed Param bruteforce concatenation on by default
- Fixed threaded and FFMPEG download (still experimental)
- Params with a None value are now excluded from being concatenated to another (but not the reverse)

Improvements
- Refactored param concatenation to use `|` instead of `+`
- Implemented sort filter sequence check
- Added an HD constant for searching
- Documented Param assertions
- Implemented `Param._concat`, which concatenates n params together, with the option to bruteforce their concatenation (used internally to test for constant types)
- You can now use the `in` keyword to check if a Param is inside another
- Updated docstrings
- User search has more parameters (unsure of the format, experimental): country, city and age
- Using concurent.futures instead of threading for threaded downloads

Note on downloads
Downloading is becoming more stable. You can use 3 download backends for one video:
- `phub.download.default`, default and dummy backend. It simply fetches a segment one after the other. It is stable but quite slow.
- `phub.download.FFMPEG`, which let FFMPEG handle the whole download. It makes it really stable and fast, but as FFMPEG is a CLI tool, progress display is not available. Callback will be called at start (`0`) and at the end (`1`).
- `phub.download.threaded`, which uses a threaded concurent.futures pool to download everything as fast as possible. This is still experimental but already quite faster than a default download. You can also select the maximum number of workers and requests timeouts.
python
Default download
video.download(..., downloader = phub.download.default)

FFMPEG download
video.download(..., downloader = phub.download.FFMPEG)

Threaded download
video.download(..., downloader = phub.download.threaded(max_workers = 50, timeout = 30))

Note that the best threaded parameters will depend on your CPU and connection speed. You might want a higher timeout if you have a slower connection, and less workers if you have a weak CPU.

Note on download callbacks
A single download callback is not enough if you want a more precise way of keeping track of the downloading process, you can create your own custom callback object that inherits from `phub.objects.Callback`:
python
from phub import Callback

class Tracker(Callback):
def on_download(progress: int):
Execute stuff on download progress
print('Downloading', progress, '/', self.total)

def on_write(progress: int):
Execute stuff on write progress
print('Writing', progress, '/', self.total)

video.download(..., display = Tracker)

This should be useful, e.g. if you are trying to download very long videos that nescessite to keep track of their writing progress.

Simple callbacks functions that takes only 2 arguments are still available, but will be automatically trasnformed to Callback objects and only the download progress will be available. I might implement more functions into this tracker in the future (errors, retry stuff, etc.).

4.0

PHUB 4 initial stable release.

- Search filters now work (they would make no difference while searching before)
- Implemented basic features for the feed (requires bs4 for now)
- Refactored constants and Param objects
- User search (i don't know why you would need this, but there it is)

TODO:
- [x] User avatar fetching on user page (only in user search rn)
- [x] Stable FFMPEG and threaded download
- [x] Update 3.9 branch
- [x] Docstrings

Note
*This should be stable, if you see any error please report them, i'm too lazy to test stuff*

4.0beta2

A bit more stable.

- Downloading is still a mess
- FeedItem objects can't parse feed elements

4.0beta1

- Better file structure
- Better pyproject.toml
- Most features have been refactored
- Implemented unparsed feed query
- Download 'backends'
- Download display presets have their own file
- Regrouped Locals in their own file
- More reliable search video regex system
- Regex wrappers
- Mutable, concatenable search/filter parameters
- More (unwrapped) user info, like bio
- Video.get_M3U_URLseparated from Video.get_segments

Known bugs:
- search provide inacurate results
- Import system is terrible, circular imports errors
- Default download function fails often on low bandwith

4.0alpha

⚠️ Alpha release, please don't use

Improvements:
- Reworked and refactored the project structure (each object has its own file)
- Reworked all cached features with functools (no more `__properties__` crap)
- Implemented Pornhub's webmasters program:
- Video object fetch themselves in priority with it, but previous parsing features are still here. Everything can be accessed using `video.fetch('pagekey')` to use the PHUB 3 parser or `video.fetch('datakey')` to use webmasters.
- Client object use it to create better, reliable Search objects. Sadly, these objects don't have length data anymore because of webmasters limitations, but they provide more stable results, and way faster!
- Separated JQuery (JSON-based queries) from HQuery (HTML-based queries, from PHUB 3)
- This implementation improves performance of video data fetching and search queries, since we don't request the whole HTML page anymore.
- Added download backends, even though they all are shit rn.
- Made User.get and Client.get take a single argument and guess if it is a URL or not instead of having 2 arguments
- Regex constants have been and will be more minimized, and use wrappers to compile them to make for better errors messages.
- More custom errors
- Categories, (and later, Tags) can be updated using `utils.update_categories`, where they will be writen directly to the source file for better type highlighting.
- Account object is given more attributes via the `Account.connect` method, called when `Client.login` has finished running. Available features are: real account name, account avatar, wether the account is premium, and account User object representation.
- All images generated by all objects are Image objects, wrapping their URL, name and available sizes to make their downloads easier (with `Image.download`).
- Queries objects use functools caches for **all** pages instead of only the current page.
- Queries caches al their pages and Video outputs.
- Implemented more features for the User object: user bio and informations (thus implementing a cached page system into User objects).
- Video object now parses whole M3U8 segments instead of having the option to give the raw M3U file, this will probably be implemented back in the `downloader` module.
- Video objects have more cached properties: pornstars in the video, video categories, video segment.

This release is not meant for production, as some features are still missing or not well implemented yet. This is just an update on the progress so far.

TODO
- [x] Re-implement account queries (history, liked, etc.)
- [x] Refactor renew regexes
- [x] Find a way to let the user choose their query type for searching
- [x] Implement searching features
- [x] Include PHUB 3 stuff (docs, etc.)
- [x] Actually make progress on the feed object
- [x] Let user choose the size of Images downloads in a better way
- [x] Find a more reliable and less bandwith-costly way to guess a user's type
- [x] Implements tags constants, use them in harmony with categories and videos
- [ ] Handle stuff if a connected account is not from pornhub user type (e.g. a channel or a model)
- [x] Fix relative imports being messy
- [x] Rethink `__init__` files structures

Page 6 of 9

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.