track.cpython-312.pyc
1 � 2 @�h � � � d dl mZ d dlZddlmZ ddlmZ ddlmZ d dl m 3 Z 4 d dlZd dlm Z G d � d 5 � Z G d� d� Zy) � )� BeautifulSoupN� )� dual_mode)�AsyncHttpClient)� read_metadata)�List)�Pathc �\ � e Zd ZdZdedefd�Zeddedd fd�� Zed eddfd 6 �� Z d� Z 7 y) �SoundgasmTrackzZ 8 Represents a Soundgasm track with lazy-fetched metadata and download capability. 9 �title�page_urlc � � || _ || _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ 10 y �N)r r � audio_url�description�duration�bitrate�sample_rate�codec�channels�tags�bits_per_sample)�selfr r s �;/root/projects/PAPI/Python_Tests/PornAPI/Soundgasm/track.py�__init__zSoundgasmTrack.__init__ sR � ��� 11 � �� �%)���'+���&*�� �#'���'+���!%�� 12 �$(�� �&*�� �+/��� N�http_client�returnc � � K � | j r| S d}|}|�$t � }|j � � d{ ��� d} |j | j � � d{ ��� j � � d{ ��� }t |d� }|j dt j d� �� }|r<t j d|j xs d � }|r|j d 13 � | _ |j dd� � }|r|j 14 j � | _ | j s | |r|j ddd� � d{ ��� S S t! || j � � d{ ��� } | r�| j d� | _ | j d� | _ | j d� | _ | j d� | _ | j d� | _ | j d� | _ | j d� | _ |r|j ddd� � d{ ��� | S 7 ���7 ���7 ���7 ��7 ��7 �# |r|j ddd� � d{ ���7 w w xY w�w)zu 15 Fetch and populate audio URL, description, and media metadata for this track. 16 Returns self. 17 FNT�html.parser�scriptzm4a:\s*)�stringzm4a:\s*"([^"]+)"� � �divzjp-description��class_r r r r r r r )r r � 18 __aenter__�getr �textr �find�re�compile�searchr"