diff --git a/.github/workflows/tests.yml b/.github/workflows/sync-tests.yml similarity index 100% rename from .github/workflows/tests.yml rename to .github/workflows/sync-tests.yml diff --git a/README.md b/README.md index 640a491..bd7eb2c 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,10 @@
Downloads + Downloads (Async) CodeQL Analysis - API Tests - Async Branch API Tests + Sync API Tests + Async Branch API Tests
# Description diff --git a/setup.py b/setup.py index 6434163..d795e55 100644 --- a/setup.py +++ b/setup.py @@ -2,9 +2,9 @@ setup( name="xvideos_api", - version="1.5.1", + version="1.5.2", packages=find_packages(), - install_requires=["bs4", "eaf_base_api"], + install_requires=["bs4", "eaf_base_api", "httpx"], entry_points={ 'console_scripts': ['xvideos_api=xvideos_api.xvideos_api:main' # If you want to create any executable scripts diff --git a/xvideos_api/xvideos_api.py b/xvideos_api/xvideos_api.py index b5637fa..3d82fb7 100644 --- a/xvideos_api/xvideos_api.py +++ b/xvideos_api/xvideos_api.py @@ -46,30 +46,6 @@ def disable_logging(): logger.setLevel(logging.CRITICAL) -class User: - def __init__(self, content): - self.content = content - blackbox_url = f"https://xvideos.com/{REGEX_USER_BLACKBOX_URL.search(self.content).group(1)}#_tabAboutMe".replace('"', "") - self.bb_content = core.fetch(blackbox_url) - self.soup = BeautifulSoup(self.bb_content) - content = self.soup.head.find('script').text - channel_pattern = r'"channel"\s*:\s*(true|1)|"is_channel"\s*:\s*(true|1)' - self.search = re.search(channel_pattern, content, re.IGNORECASE) - - - @cached_property - def pornstar(self): - return self.search.group() - - @cached_property - def is_channel(self): - return self.is_channel - - @cached_property - def channel(self): - return - - class Video: def __init__(self, url): @@ -109,7 +85,7 @@ def is_desired_script(cls, tag): return all(content in tag.text for content in script_contents) def get_script_content(self): - soup = BeautifulSoup(self.html_content) + soup = BeautifulSoup(self.html_content, features="html.parser") target_script = soup.find(self.is_desired_script) return target_script.text @@ -117,7 +93,7 @@ def get_html_content(self) -> Union[str, httpx.Response]: return core.fetch(self.url) def extract_json_from_html(self): - soup = BeautifulSoup(self.html_content) + soup = BeautifulSoup(self.html_content, features="html.parser") script_tags = soup.find_all('script', {'type': 'application/ld+json'}) combined_data = {} @@ -258,10 +234,6 @@ def embed_url(self) -> str: def cdn_url(self) -> str: return self.json_data["contentUrl"] - @cached_property - def user(self) -> User: - return User(self.html_content) - class Pornstar: def __init__(self, url): @@ -308,7 +280,7 @@ def get_video(cls, url: str) -> Video: @classmethod def extract_video_urls(cls, html_content: str) -> list: # Parse the HTML content with BeautifulSoup - soup = BeautifulSoup(html_content) + soup = BeautifulSoup(html_content, features="html.parser") video_urls = [] # Find all 'div' elements with the class 'thumb'