Skip to content

Commit

Permalink
- added total video views to pornstar object
Browse files Browse the repository at this point in the history
  • Loading branch information
EchterAlsFake committed Jul 7, 2024
1 parent 9089183 commit 1b45edd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion xnxx_api/modules/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
REGEX_SCRAPE_VIDEOS = re.compile(r'<div class="thumb"><a href="/video-(.*?)"')

REGEX_SEARCH_TOTAL_PAGES = re.compile(r'class="last-page">(.*?)</a>')
REGEX_MODEL_TOTAL_PAGES = re.compile(r'<a class="last-page" data-page="(.*?)">')
REGEX_MODEL_TOTAL_PAGES = re.compile(r'<a class="last-page" data-page="(.*?)">')
REGEX_MODEL_TOTAL_VIDEO_VIEWS = re.compile(r'<span class="icon-f icf-eye"></span> (.*?) video views')
7 changes: 6 additions & 1 deletion xnxx_api/xnxx_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class User:
def __init__(self, url):
self.url = url
self.pages = round(self.total_videos / 50)
self.content = Core().get_content(url).decode("utf-8")

@cached_property
def base_json(self):
Expand Down Expand Up @@ -239,6 +240,10 @@ def videos(self):
def total_videos(self):
return self.base_json["nb_videos"]

@cached_property
def total_video_views(self):
return REGEX_MODEL_TOTAL_VIDEO_VIEWS.search(self.content).group(1)


class Client:

Expand Down Expand Up @@ -303,4 +308,4 @@ def main():


if __name__ == "__main__":
main()
main()

0 comments on commit 1b45edd

Please sign in to comment.