Russell-Newton / TikTokPy

Extract data from TikTok without needing any login information or API keys.
https://pypi.org/project/tiktokapipy/
MIT License
192 stars 24 forks source link

Key Changes for Video Info improvements #79

Closed zakrian07 closed 8 months ago

zakrian07 commented 8 months ago

Updated and streamlined models to match the current data structure and usage requirements. Enhanced readability and maintainability of the code by removing unused fields and methods. Additions Added @computed_field and @cached_property decorators for properties in the Video class to handle lazy loading and API interactions. Introduced new utility functions video_link and is_mobile_share_link for generating TikTok video links and checking mobile share links. Added detailed comments and docstrings for clarity and documentation purposes. Fixes and Improvements SubtitleData Model:

Changed language_id from a mandatory field to an optional field with a default alias (Field(alias='LanguageID')). VideoData Model:

Added optional fields encoded_type, video_quality, encode_user_tag, codec_type, and definition. Ensured optional nature of some fields to handle cases where data might not be available. MusicData Model:

Streamlined fields and ensured they align with the actual data received from the API. LightVideo and Video Models:

Simplified these models by removing attributes and methods not present or necessary in the response structure. General Code Improvements:

Refactored the structure of models for better alignment with the data provided by the TikTok API. Improved code organization and removed redundant or unused code segments. Enhanced error handling in deferred collectors and API interaction methods. Circular Dependency Resolution:

Moved the re-imports of some models (Challenge, LightChallenge, Comment, LightUser, User, UserStats) to the end of the file to resolve circular dependencies. Removed Eliminated unnecessary methods and properties related to image data handling (image_data and image_url_list) in the Video model, as they were not aligned with the current response structure.

zakrian07 commented 8 months ago

@Russell-Newton it was import issue it was my local src file path i just update try to merge now

Russell-Newton commented 8 months ago

I'll try the merge later today or tomorrow when I get back home.

zakrian07 commented 8 months ago

please run again these were local versions while import for source files tiktokapipy is replaced now everywhere in video.py it should pass validations now

Russell-Newton commented 8 months ago

I'm going to merge this in knowing that it doesn't pass validation checks. I'll try to fix them before bumping the version number.