beeg_api 1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
beeg_api-1.1/LICENSE ADDED
@@ -0,0 +1,56 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+
6
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7
+
8
+ This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
9
+
10
+ 0. Additional Definitions.
11
+ As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
12
+
13
+ “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
14
+
15
+ An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
16
+
17
+ A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
18
+
19
+ The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
20
+
21
+ The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
22
+
23
+ 1. Exception to Section 3 of the GNU GPL.
24
+ You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
25
+
26
+ 2. Conveying Modified Versions.
27
+ If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
28
+
29
+ a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
30
+ b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
31
+ 3. Object Code Incorporating Material from Library Header Files.
32
+ The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
33
+
34
+ a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
35
+ b) Accompany the object code with a copy of the GNU GPL and this license document.
36
+ 4. Combined Works.
37
+ You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
38
+
39
+ a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
40
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
41
+ c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
42
+ d) Do one of the following:
43
+ 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
44
+ 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
45
+ e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
46
+ 5. Combined Libraries.
47
+ You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
48
+
49
+ a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
50
+ b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
51
+ 6. Revised Versions of the GNU Lesser General Public License.
52
+ The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
53
+
54
+ Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
55
+
56
+ If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
beeg_api-1.1/PKG-INFO ADDED
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: beeg_api
3
+ Version: 1.1
4
+ Summary: A Python API for the Porn Site beeg.com
5
+ Author: Johannes Habel
6
+ Author-email: Johannes Habel <EchterAlsFake@proton.me>
7
+ License-Expression: LGPL-3.0-only
8
+ License-File: LICENSE
9
+ Classifier: Programming Language :: Python
10
+ Requires-Dist: eaf-base-api
11
+ Requires-Dist: m3u8
12
+ Requires-Dist: av ; python_full_version >= '3.10' and extra == 'av'
13
+ Requires-Dist: httpx[http2] ; extra == 'full'
14
+ Requires-Dist: httpx[socks] ; extra == 'full'
15
+ Requires-Python: >=3.9
16
+ Project-URL: Homepage, https://github.com/EchterAlsFake/beeg_api
17
+ Provides-Extra: av
18
+ Provides-Extra: full
@@ -0,0 +1,4 @@
1
+ __all__ = ["Client", "Video"]
2
+
3
+
4
+ from beeg_api.beeg_api import Client, Video
@@ -0,0 +1,110 @@
1
+ """
2
+ Copyright (C) 2025-2026 Johannes Habel
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ """
17
+ import os
18
+ import logging
19
+ import threading
20
+
21
+ from typing import Optional
22
+ from functools import cached_property
23
+ from base_api.base import BaseCore, setup_logger
24
+
25
+ try:
26
+ from modules.consts import *
27
+
28
+ except (ModuleNotFoundError, ImportError):
29
+ from .modules.consts import *
30
+
31
+
32
+ class Video:
33
+ def __init__(self, url: str, core: BaseCore):
34
+ self.url = url
35
+ self.core = core
36
+ self.json_data: dict = self.core.fetch(f"https://store.externulls.com/facts/file/{self.key}", get_response=True).json() # This is the holy grail
37
+ self.logger = setup_logger(name="BEEG API - [Video]", log_file=None, level=logging.ERROR)
38
+
39
+ def enable_logging(self, log_file: str = None, level=None, log_ip: str = None, log_port: int = None):
40
+ self.logger = setup_logger(name="BEEG API - [Video]", log_file=log_file, level=level, http_ip=log_ip,
41
+ http_port=log_port)
42
+
43
+ @cached_property
44
+ def key(self) -> str:
45
+ return self.url.split("/")[-1].strip("-0") # The video key used across the page for all APIs
46
+
47
+ @cached_property
48
+ def title(self) -> str:
49
+ return self.json_data.get("file").get("data")[0].get("cd_value")
50
+
51
+ @cached_property
52
+ def video_id(self) -> str:
53
+ return self.json_data.get("file").get("data")[0].get("id")
54
+
55
+ @cached_property
56
+ def duration(self) -> int:
57
+ return self.json_data.get("file").get("fl_duration")
58
+
59
+ @cached_property
60
+ def m3u8_base_url(self) -> str:
61
+ url = self.json_data.get("file").get("hls_resources").get("fl_cdn_multi")
62
+ return f"https://video.externulls.com/{url}"
63
+
64
+ def get_segments(self, quality) -> list:
65
+ """
66
+ :param quality: (str, Quality) The video quality
67
+ :return: (list) A list of segments (the .ts files)
68
+ """
69
+ segments = self.core.get_segments(quality=quality, m3u8_url_master=self.m3u8_base_url)
70
+ return segments
71
+
72
+ def download(self, quality, path="./", callback=None, no_title=False, remux: bool = False,
73
+ callback_remux=None, start_segment: int = 0, stop_event: Optional[threading.Event] = None,
74
+ segment_state_path: Optional[str] = None, segment_dir: Optional[str] = None,
75
+ return_report: bool = False, cleanup_on_stop: bool = True, keep_segment_dir: bool = False
76
+ ) -> bool:
77
+ """
78
+ :param callback:
79
+ :param quality:
80
+ :param path:
81
+ :param no_title:
82
+ :param remux:
83
+ :param callback_remux:
84
+ :param start_segment:
85
+ :param stop_event:
86
+ :param segment_state_path:
87
+ :param segment_dir:
88
+ :param return_report:
89
+ :param cleanup_on_stop:
90
+ :param keep_segment_dir:
91
+ :return:
92
+ """
93
+ if not no_title:
94
+ path = os.path.join(path, f"{self.title}.mp4")
95
+
96
+ return self.core.download(video=self, quality=quality, path=path, callback=callback, remux=remux,
97
+ callback_remux=callback_remux, start_segment=start_segment, stop_event=stop_event,
98
+ segment_state_path=segment_state_path, segment_dir=segment_dir,
99
+ return_report=return_report,
100
+ cleanup_on_stop=cleanup_on_stop, keep_segment_dir=keep_segment_dir)
101
+
102
+
103
+ class Client:
104
+ def __init__(self, core: BaseCore = None):
105
+ self.core = core or BaseCore()
106
+ self.core.initialize_session()
107
+
108
+ def get_video(self, url: str) -> Video:
109
+ return Video(url, core=self.core)
110
+
File without changes
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ from ..beeg_api import Client
2
+ from base_api import BaseCore
3
+ from base_api.modules.config import RuntimeConfig
4
+
5
+ config = RuntimeConfig()
6
+ config.videos_concurrency = 1
7
+ config.pages_concurrency = 1
8
+ core = BaseCore(config=config)
9
+
10
+ client = Client(core=core)
11
+ video = client.get_video("https://beeg.com/-0830673897358738")
12
+
13
+ def test_all():
14
+ assert isinstance(video.title, str) and len(video.title) > 0
15
+ assert isinstance(video.m3u8_base_url, str) and len(video.m3u8_base_url) > 0
16
+ assert isinstance(video.video_id, int) and len(str(video.video_id)) > 0
17
+ assert isinstance(video.json_data, dict)
18
+ assert isinstance(video.key, str) and len(video.key) > 0
19
+ stuff = video.download(quality="worst", return_report=True)
20
+ assert stuff["status"] == "completed"
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.9.30,<0.10.0"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "beeg_api"
7
+ version = "1.1"
8
+ description = "A Python API for the Porn Site beeg.com"
9
+ requires-python = ">=3.9"
10
+ license = "LGPL-3.0-only"
11
+ license-files = ["LICENSE"]
12
+ authors = [
13
+ { name = "Johannes Habel", email = "EchterAlsFake@proton.me" }
14
+ ]
15
+ dependencies = [
16
+ "eaf_base_api",
17
+ "m3u8"
18
+ ]
19
+ classifiers = [
20
+ "Programming Language :: Python",
21
+ ]
22
+
23
+ [project.urls]
24
+ Homepage = "https://github.com/EchterAlsFake/beeg_api"
25
+
26
+ [project.optional-dependencies]
27
+ av = ["av; python_version >= '3.10'"]
28
+ full = ["httpx[http2]", "httpx[socks]"] # H2 for HTTP 2.0 support, LXML for faster parsing speed, though optional :)
29
+
30
+ [tool.uv.build-backend]
31
+ module-root = ""