simple-rule34 0.1.6__py3-none-any.whl → 0.1.6.1__py3-none-any.whl
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.
- SimpleRule34/Rule34.py +6 -4
- simple_rule34-0.1.6.1.dist-info/METADATA +58 -0
- simple_rule34-0.1.6.1.dist-info/RECORD +11 -0
- {simple_rule34-0.1.6.dist-info → simple_rule34-0.1.6.1.dist-info}/WHEEL +1 -1
- SimpleRule34/aio/ARule34.py +0 -186
- SimpleRule34/aio/types.py +0 -98
- SimpleRule34/aio/utils.py +0 -22
- SimpleRule34/setup.py +0 -26
- simple_rule34-0.1.6.dist-info/METADATA +0 -57
- simple_rule34-0.1.6.dist-info/RECORD +0 -15
- {simple_rule34-0.1.6.dist-info → simple_rule34-0.1.6.1.dist-info/licenses}/LICENSE +0 -0
- {simple_rule34-0.1.6.dist-info → simple_rule34-0.1.6.1.dist-info}/top_level.txt +0 -0
SimpleRule34/Rule34.py
CHANGED
|
@@ -11,12 +11,14 @@ from .types import *
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class Rule34Api:
|
|
14
|
-
def __init__(self):
|
|
14
|
+
def __init__(self, api_str: str):
|
|
15
15
|
self.header = {'User-Agent': 'rule34-simple-api 0.1.5.6 (Request)'}
|
|
16
|
+
self.api_str = api_str
|
|
17
|
+
|
|
16
18
|
async def get_post_count(self, tags: str = '') -> int:
|
|
17
19
|
async with aiohttp.ClientSession(headers=self.header) as session:
|
|
18
20
|
async with session.get(f'https://api.rule34.xxx/index.php?'
|
|
19
|
-
f'page=dapi&s=post&q=index&tags={tags}') as response:
|
|
21
|
+
f'page=dapi&s=post&q=index&tags={tags}&{self.api_str}') as response:
|
|
20
22
|
xml_data = await response.text()
|
|
21
23
|
|
|
22
24
|
xml_root = ET.fromstring(xml_data)
|
|
@@ -28,7 +30,7 @@ class Rule34Api:
|
|
|
28
30
|
|
|
29
31
|
async with aiohttp.ClientSession(headers=self.header) as session:
|
|
30
32
|
async with session.get(f'https://api.rule34.xxx/index.php?'
|
|
31
|
-
f'json=1&page=dapi&s=post&q=index&id={id}') as response:
|
|
33
|
+
f'json=1&page=dapi&s=post&q=index&id={id}&{self.api_str}') as response:
|
|
32
34
|
if response.status != 200:
|
|
33
35
|
raise ApiException(f"Api returned status code {response.status} with message"
|
|
34
36
|
f" {await response.text()}")
|
|
@@ -113,7 +115,7 @@ class Rule34Api:
|
|
|
113
115
|
start_time = time.time()
|
|
114
116
|
|
|
115
117
|
async with session.get(f'https://api.rule34.xxx/index.php?'
|
|
116
|
-
f'json=1&page=dapi&s=post&q=index&limit={limit}&pid={page_id}&tags={tags}') as response:
|
|
118
|
+
f'json=1&page=dapi&s=post&q=index&limit={limit}&pid={page_id}&tags={tags}&{self.api_str}') as response:
|
|
117
119
|
if response.status != 200:
|
|
118
120
|
raise ApiException(f"Api returned status code {response.status} with message"
|
|
119
121
|
f" {await response.text()}")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: simple_rule34
|
|
3
|
+
Version: 0.1.6.1
|
|
4
|
+
Summary: Simple api wrapper of rule34.xxx for python with asynchronous support
|
|
5
|
+
Author-email: StarMan12 <author@example.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/SyperAlexKomp/simple-rule34-api
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/SyperAlexKomp/simple-rule34-api/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: aiohttp==3.8.4
|
|
15
|
+
Requires-Dist: aiosignal==1.3.1
|
|
16
|
+
Requires-Dist: alabaster==0.7.13
|
|
17
|
+
Requires-Dist: async-timeout==4.0.2
|
|
18
|
+
Requires-Dist: attrs==23.1.0
|
|
19
|
+
Requires-Dist: Babel==2.9.1
|
|
20
|
+
Requires-Dist: build==0.10.0
|
|
21
|
+
Requires-Dist: certifi==2023.5.7
|
|
22
|
+
Requires-Dist: charset-normalizer==3.2.0
|
|
23
|
+
Requires-Dist: colorama==0.4.6
|
|
24
|
+
Requires-Dist: docopt==0.6.2
|
|
25
|
+
Requires-Dist: docutils==0.18.1
|
|
26
|
+
Requires-Dist: frozenlist==1.4.0
|
|
27
|
+
Requires-Dist: idna==3.4
|
|
28
|
+
Requires-Dist: imagesize==1.4.1
|
|
29
|
+
Requires-Dist: importlib-metadata==6.8.0
|
|
30
|
+
Requires-Dist: Jinja2==3.1.2
|
|
31
|
+
Requires-Dist: MarkupSafe==2.1.3
|
|
32
|
+
Requires-Dist: multidict==6.0.4
|
|
33
|
+
Requires-Dist: packaging==23.1
|
|
34
|
+
Requires-Dist: pipreqs==0.4.13
|
|
35
|
+
Requires-Dist: Pygments==2.15.1
|
|
36
|
+
Requires-Dist: pyproject_hooks==1.0.0
|
|
37
|
+
Requires-Dist: requests==2.31.0
|
|
38
|
+
Requires-Dist: snowballstemmer==2.2.0
|
|
39
|
+
Requires-Dist: Sphinx==6.2.1
|
|
40
|
+
Requires-Dist: sphinx-rtd-theme==1.2.2
|
|
41
|
+
Requires-Dist: sphinxcontrib-applehelp==1.0.4
|
|
42
|
+
Requires-Dist: sphinxcontrib-devhelp==1.0.2
|
|
43
|
+
Requires-Dist: sphinxcontrib-htmlhelp==2.0.1
|
|
44
|
+
Requires-Dist: sphinxcontrib-jquery==4.1
|
|
45
|
+
Requires-Dist: sphinxcontrib-jsmath==1.0.1
|
|
46
|
+
Requires-Dist: sphinxcontrib-qthelp==1.0.3
|
|
47
|
+
Requires-Dist: sphinxcontrib-serializinghtml==1.1.5
|
|
48
|
+
Requires-Dist: tomli==2.0.1
|
|
49
|
+
Requires-Dist: urllib3==2.0.3
|
|
50
|
+
Requires-Dist: yarg==0.1.9
|
|
51
|
+
Requires-Dist: yarl==1.9.2
|
|
52
|
+
Requires-Dist: zipp==3.16.2
|
|
53
|
+
Requires-Dist: aiofiles~=23.2.1
|
|
54
|
+
Requires-Dist: pydantic~=2.7.1
|
|
55
|
+
Dynamic: license-file
|
|
56
|
+
|
|
57
|
+
# rule34-simple-api
|
|
58
|
+
Simple api wrapper of rule34.xxx for python with asynchronous support
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
SimpleRule34/Rule34.py,sha256=Oe9zpotMgJWeqvo-TAn6OqQoyGqsSsHdAOtTNGI-KoA,5526
|
|
3
|
+
SimpleRule34/__init__.py,sha256=C4IbcJ_rjqBhpENXImVGuEQxf81GUwNaycqNNAY_ROc,31
|
|
4
|
+
SimpleRule34/exceptions.py,sha256=dUpJBROzXWT67ZOLAHWWse0srvMRunIa9rSl1Cs10B8,491
|
|
5
|
+
SimpleRule34/types.py,sha256=n9y60b96g9wyD8FAZ_ElETBFNnM1F1GAs5VoxzCFI68,1518
|
|
6
|
+
SimpleRule34/utils.py,sha256=fWx-ntJ672NoktH5Ws9-FcO0gtCNVmd8VfxFxjWqsD0,616
|
|
7
|
+
simple_rule34-0.1.6.1.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
8
|
+
simple_rule34-0.1.6.1.dist-info/METADATA,sha256=FqjEHB4rhE-PiCgpMam0WY9U93vHspcu5lZb7OGQ8wg,2138
|
|
9
|
+
simple_rule34-0.1.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
simple_rule34-0.1.6.1.dist-info/top_level.txt,sha256=YI-Z1ijzIjlJw2WeM95PSmClCzIvm24KAlyZi80YVNs,22
|
|
11
|
+
simple_rule34-0.1.6.1.dist-info/RECORD,,
|
SimpleRule34/aio/ARule34.py
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import random
|
|
2
|
-
import time
|
|
3
|
-
|
|
4
|
-
import aiohttp
|
|
5
|
-
import datetime
|
|
6
|
-
import logging
|
|
7
|
-
import xml.etree.ElementTree as ET
|
|
8
|
-
|
|
9
|
-
from ..exceptions import *
|
|
10
|
-
from .types import *
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
async def parse_result(post_element):
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
id = int(post_element.get('id'))
|
|
17
|
-
height = int(post_element.get('height'))
|
|
18
|
-
width = int(post_element.get('width'))
|
|
19
|
-
url = post_element.get('file_url')
|
|
20
|
-
|
|
21
|
-
sample_height = int(post_element.get('sample_height'))
|
|
22
|
-
sample_width = int(post_element.get('sample_width'))
|
|
23
|
-
sample_url = post_element.get('sample_url')
|
|
24
|
-
|
|
25
|
-
sample_post = Rule34SamplePost(sample_height, sample_width, sample_url, id)
|
|
26
|
-
|
|
27
|
-
preview_height = int(post_element.get('preview_height'))
|
|
28
|
-
preview_width = int(post_element.get('preview_width'))
|
|
29
|
-
preview_url = post_element.get('preview_url')
|
|
30
|
-
|
|
31
|
-
preview_post = Rule34PreviewPost(preview_height, preview_width, preview_url, id)
|
|
32
|
-
|
|
33
|
-
score = int(post_element.get('score'))
|
|
34
|
-
rating = post_element.get('rating')
|
|
35
|
-
creator_id = int(post_element.get('creator_id'))
|
|
36
|
-
tags = post_element.get('tags')
|
|
37
|
-
has_children = post_element.get('has_children') == 'true'
|
|
38
|
-
created_date = datetime.datetime.strptime(post_element.get('created_at'), "%a %b %d %H:%M:%S %z %Y")
|
|
39
|
-
status = post_element.get('status')
|
|
40
|
-
source = post_element.get('source')
|
|
41
|
-
has_notes = post_element.get('has_notes') == 'true'
|
|
42
|
-
has_comments = post_element.get('has_comments') == 'true'
|
|
43
|
-
|
|
44
|
-
main_post = Rule34MainPost(score, rating, creator_id, tags, has_children, created_date, status,
|
|
45
|
-
source, has_notes, has_comments, height, width, url, id)
|
|
46
|
-
|
|
47
|
-
return main_post, sample_post, preview_post
|
|
48
|
-
|
|
49
|
-
class Rule34Api:
|
|
50
|
-
def __init__(self):
|
|
51
|
-
self.header = {'User-Agent': 'rule34-simple-api 0.1.5.3 (Request)'}
|
|
52
|
-
async def get_post_count(self, tags: str = '') -> int:
|
|
53
|
-
async with aiohttp.ClientSession(headers=self.header) as session:
|
|
54
|
-
async with session.get(f'https://api.rule34.xxx/index.php?'
|
|
55
|
-
f'page=dapi&s=post&q=index&tags={tags}') as response:
|
|
56
|
-
xml_data = await response.text()
|
|
57
|
-
|
|
58
|
-
xml_root = ET.fromstring(xml_data)
|
|
59
|
-
|
|
60
|
-
return int(xml_root.get('count'))
|
|
61
|
-
|
|
62
|
-
async def get_post(self, id: int):
|
|
63
|
-
st = time.time()
|
|
64
|
-
|
|
65
|
-
async with aiohttp.ClientSession(headers=self.header) as session:
|
|
66
|
-
async with session.get(f'https://api.rule34.xxx/index.php?'
|
|
67
|
-
f'page=dapi&s=post&q=index&id={id}') as response:
|
|
68
|
-
xml_data = await response.text()
|
|
69
|
-
|
|
70
|
-
try:
|
|
71
|
-
xml_root = ET.fromstring(xml_data)
|
|
72
|
-
except:
|
|
73
|
-
return None
|
|
74
|
-
|
|
75
|
-
post_element = xml_root.find('post')
|
|
76
|
-
|
|
77
|
-
parsed = await parse_result(post_element)
|
|
78
|
-
|
|
79
|
-
if parsed is None:
|
|
80
|
-
return None
|
|
81
|
-
else:
|
|
82
|
-
main_post, sample_post, preview_post = parsed
|
|
83
|
-
|
|
84
|
-
logging.info(f"Post where found in {time.time() - st}s")
|
|
85
|
-
|
|
86
|
-
return Rule34PostData(id, main_post, sample_post, preview_post)
|
|
87
|
-
|
|
88
|
-
async def get_random_post(self, tags: str = '', forbidden_tags: list[str] = []):
|
|
89
|
-
start_time = time.time()
|
|
90
|
-
|
|
91
|
-
post_count = await self.get_post_count(tags)
|
|
92
|
-
|
|
93
|
-
page_count = post_count // 1000
|
|
94
|
-
|
|
95
|
-
if page_count > 0:
|
|
96
|
-
post_list = await self.get_post_list(page_id=random.randint(0, page_count if page_count <= 200 else 200),
|
|
97
|
-
tags=tags, limit=1000)
|
|
98
|
-
|
|
99
|
-
else:
|
|
100
|
-
post_list = await self.get_post_list(tags=tags, limit=1000)
|
|
101
|
-
|
|
102
|
-
post_list_ = []
|
|
103
|
-
|
|
104
|
-
for post in post_list:
|
|
105
|
-
if any(tag in forbidden_tags for tag in post.main.tags):
|
|
106
|
-
pass
|
|
107
|
-
else:
|
|
108
|
-
post_list_.append(post)
|
|
109
|
-
|
|
110
|
-
logging.info(f"Random post where found in {time.time() - start_time}s")
|
|
111
|
-
|
|
112
|
-
return post_list_[random.randint(0, len(post_list_) - 1)] if len(post_list_) > 0 else None
|
|
113
|
-
|
|
114
|
-
async def get_random_posts(self, tags: str = '', count: int = 8, forbidden_tags: list[str] = []) -> list[Rule34PostData]:
|
|
115
|
-
st = time.time()
|
|
116
|
-
|
|
117
|
-
request_count = 1
|
|
118
|
-
true_count = count*20
|
|
119
|
-
|
|
120
|
-
post_list = []
|
|
121
|
-
|
|
122
|
-
if true_count > 1000:
|
|
123
|
-
request_count = true_count // 1000
|
|
124
|
-
|
|
125
|
-
post_count = await self.get_post_count(tags)
|
|
126
|
-
page_id = int(random.randint(0, int(post_count / true_count)) / 8) if post_count >= true_count else 0
|
|
127
|
-
|
|
128
|
-
for pid in range(request_count + 1):
|
|
129
|
-
post_list += await self.get_post_list(tags=tags, forbidden_tags=forbidden_tags,
|
|
130
|
-
page_id=page_id, limit=true_count if true_count <= 1000 else 1000)
|
|
131
|
-
|
|
132
|
-
getted = []
|
|
133
|
-
|
|
134
|
-
for x in range(count):
|
|
135
|
-
if len(post_list) > 0:
|
|
136
|
-
getted.append(post_list[random.randint(0, len(post_list) - 1)])
|
|
137
|
-
else:
|
|
138
|
-
pass
|
|
139
|
-
|
|
140
|
-
logging.info(f"{count} random posts where found in {time.time() - st}s")
|
|
141
|
-
|
|
142
|
-
return getted
|
|
143
|
-
|
|
144
|
-
async def get_post_list(self, limit: int = 1000, page_id: int = 0, tags: str = '', forbidden_tags: list[str] = [])\
|
|
145
|
-
-> list[Rule34PostData]:
|
|
146
|
-
async with aiohttp.ClientSession(headers=self.header) as session:
|
|
147
|
-
if limit > 1000:
|
|
148
|
-
raise ToBigRequestException(f"The max size of request is 1000 when you tried to request {limit}")
|
|
149
|
-
|
|
150
|
-
start_time = time.time()
|
|
151
|
-
|
|
152
|
-
async with session.get(f'https://api.rule34.xxx/index.php?'
|
|
153
|
-
f'page=dapi&s=post&q=index&limit={limit}&pid={page_id}&tags={tags}') as response:
|
|
154
|
-
xml_data = await response.text()
|
|
155
|
-
|
|
156
|
-
logging.debug(f"Request with {limit} limit posts were done in {time.time() - start_time}s")
|
|
157
|
-
|
|
158
|
-
xml_root = ET.fromstring(xml_data)
|
|
159
|
-
posts = xml_root.findall('post')
|
|
160
|
-
post_list = []
|
|
161
|
-
|
|
162
|
-
start_time = time.time()
|
|
163
|
-
|
|
164
|
-
for post_element in posts:
|
|
165
|
-
parsed = await parse_result(post_element)
|
|
166
|
-
|
|
167
|
-
if parsed is None:
|
|
168
|
-
return []
|
|
169
|
-
else:
|
|
170
|
-
main_post, sample_post, preview_post = parsed
|
|
171
|
-
|
|
172
|
-
post_list.append(Rule34PostData(main_post.id, main_post, sample_post, preview_post))
|
|
173
|
-
|
|
174
|
-
logging.debug(f"Creating {len(posts)} objects was done in {time.time() - start_time}s")
|
|
175
|
-
|
|
176
|
-
post_list_ = []
|
|
177
|
-
|
|
178
|
-
for post in post_list:
|
|
179
|
-
if any(tag in forbidden_tags for tag in post.main.tags):
|
|
180
|
-
pass
|
|
181
|
-
else:
|
|
182
|
-
post_list_.append(post)
|
|
183
|
-
|
|
184
|
-
logging.info(f"{len(post_list_)} posts where found in {time.time() - start_time}s")
|
|
185
|
-
|
|
186
|
-
return post_list_
|
SimpleRule34/aio/types.py
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import typing
|
|
2
|
-
|
|
3
|
-
import aiofiles
|
|
4
|
-
import aiohttp
|
|
5
|
-
import os
|
|
6
|
-
import datetime
|
|
7
|
-
|
|
8
|
-
from .utils import get_file_size, get_file_type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Rule34Post:
|
|
12
|
-
def __init__(self, height: int, width: int, url: str, id: int):
|
|
13
|
-
self.path = r'./rule34_download'
|
|
14
|
-
self.height = height
|
|
15
|
-
self.width = width
|
|
16
|
-
self.url = url
|
|
17
|
-
self.id = id
|
|
18
|
-
self.file_type = get_file_type(self.url)
|
|
19
|
-
|
|
20
|
-
def __str__(self):
|
|
21
|
-
return f"<Rule34Post(id={self.id}, height={self.height}, width={self.width}, url={self.url})>"
|
|
22
|
-
|
|
23
|
-
async def get_file_size(self) -> typing.Optional[int]:
|
|
24
|
-
async with aiohttp.ClientSession() as session:
|
|
25
|
-
file_size = await get_file_size(self.url, session)
|
|
26
|
-
return file_size
|
|
27
|
-
|
|
28
|
-
async def download(self, path=r'./rule34_download'):
|
|
29
|
-
async with aiohttp.ClientSession() as session:
|
|
30
|
-
async with session.get(self.url) as response:
|
|
31
|
-
if response.status == 200:
|
|
32
|
-
try:
|
|
33
|
-
os.mkdir(self.path)
|
|
34
|
-
except:
|
|
35
|
-
pass
|
|
36
|
-
|
|
37
|
-
file_name = os.path.basename(self.url)
|
|
38
|
-
save_path = os.path.join(path, file_name)
|
|
39
|
-
async with aiofiles.open(save_path, 'wb') as file:
|
|
40
|
-
await file.write(await response.read())
|
|
41
|
-
|
|
42
|
-
return save_path
|
|
43
|
-
else:
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
async def get_bytes(self):
|
|
47
|
-
async with aiohttp.ClientSession() as session:
|
|
48
|
-
async with session.get(self.url) as response:
|
|
49
|
-
return await response.read()
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class Rule34MainPost(Rule34Post):
|
|
53
|
-
def __init__(self, score: int, rating: str, creator_id: int, tags: str, has_children: bool,
|
|
54
|
-
created_date: datetime.datetime, status: str, source: str, has_notes: bool, has_comments: bool,
|
|
55
|
-
height: int, width: int, url: str, id: int):
|
|
56
|
-
super().__init__(height, width, url, id)
|
|
57
|
-
self.score = score
|
|
58
|
-
self.rating = rating
|
|
59
|
-
self.creator_id = creator_id
|
|
60
|
-
self.tags = tags.split(" ")
|
|
61
|
-
self.has_children = has_children
|
|
62
|
-
self.created_date = created_date
|
|
63
|
-
self.status = status
|
|
64
|
-
self.source = source
|
|
65
|
-
self.has_notes = has_notes
|
|
66
|
-
self.has_comments = has_comments
|
|
67
|
-
|
|
68
|
-
def __str__(self):
|
|
69
|
-
return f"<Rule34MainPost(id={self.id}, height={self.height}, width={self.width}, url={self.url}," \
|
|
70
|
-
f" score={self.score}, rating={self.rating}, creator_id={self.creator_id}," \
|
|
71
|
-
f" has_children={self.has_children}, has_notes={self.has_notes}, has_comments={self.has_comments}" \
|
|
72
|
-
f" created_date={self.created_date}, status={self.status}, tags={self.tags})>"
|
|
73
|
-
|
|
74
|
-
def format_tags(self, format: str = "#"):
|
|
75
|
-
str_tags = (format + ' ').join(self.tags)
|
|
76
|
-
return str_tags.split(" ")
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class Rule34SamplePost(Rule34Post):
|
|
80
|
-
def __str__(self):
|
|
81
|
-
return f"<Rule34SamplePost(id={self.id}, height={self.height}, width={self.width}, url={self.url})>"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class Rule34PreviewPost(Rule34Post):
|
|
85
|
-
def __str__(self):
|
|
86
|
-
return f"<Rule34PreviewPost(id={self.id}, height={self.height}, width={self.width}, url={self.url})>"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
class Rule34PostData:
|
|
90
|
-
def __init__(self, id: int, main: Rule34MainPost, sample: Rule34SamplePost, preview: Rule34PreviewPost):
|
|
91
|
-
self.id = id
|
|
92
|
-
self.main = main
|
|
93
|
-
self.sample = sample
|
|
94
|
-
self.preview = preview
|
|
95
|
-
|
|
96
|
-
def __str__(self):
|
|
97
|
-
return f"<Rule34PostData(id={self.id}, main={str(self.main)}, sample={str(self.sample)}," \
|
|
98
|
-
f" preview={str(self.preview)})>"
|
SimpleRule34/aio/utils.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
async def get_file_size(url, session):
|
|
3
|
-
async with session.head(url=url, allow_redirects=True) as response:
|
|
4
|
-
if 'Content-Length' in response.headers:
|
|
5
|
-
size = int(response.headers['Content-Length'])
|
|
6
|
-
return size
|
|
7
|
-
else:
|
|
8
|
-
return None
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def get_file_type(url):
|
|
12
|
-
file_extension = url.split('.')[-1].lower()
|
|
13
|
-
if file_extension in ['jpg', 'jpeg', 'png']:
|
|
14
|
-
return 'photo'
|
|
15
|
-
elif file_extension in ['mp4', 'avi', 'mov']:
|
|
16
|
-
return 'video'
|
|
17
|
-
elif file_extension == 'gif':
|
|
18
|
-
return 'animation'
|
|
19
|
-
else:
|
|
20
|
-
return None
|
|
21
|
-
|
|
22
|
-
|
SimpleRule34/setup.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
setup(
|
|
4
|
-
name='SimpleRule34',
|
|
5
|
-
version='0.1',
|
|
6
|
-
description='Simple api wrapper of rule34.xxx for python with asynchronous support',
|
|
7
|
-
packages=find_packages(),
|
|
8
|
-
install_requires=[
|
|
9
|
-
'aiohttp==3.8.4',
|
|
10
|
-
'aiosignal==1.3.1',
|
|
11
|
-
'async-timeout==4.0.2',
|
|
12
|
-
'attrs==23.1.0',
|
|
13
|
-
'certifi==2023.5.7',
|
|
14
|
-
'charset-normalizer==3.2.0',
|
|
15
|
-
'docopt==0.6.2',
|
|
16
|
-
'frozenlist==1.4.0',
|
|
17
|
-
'idna==3.4',
|
|
18
|
-
'multidict==6.0.4',
|
|
19
|
-
'pipreqs==0.4.13',
|
|
20
|
-
'requests==2.31.0',
|
|
21
|
-
'urllib3==2.0.3',
|
|
22
|
-
'yarg==0.1.9',
|
|
23
|
-
'yarl==1.9.2',
|
|
24
|
-
],
|
|
25
|
-
url='https://github.com/Loshok229/rule34-simple-api'
|
|
26
|
-
)
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: simple_rule34
|
|
3
|
-
Version: 0.1.6
|
|
4
|
-
Summary: Simple api wrapper of rule34.xxx for python with asynchronous support
|
|
5
|
-
Author-email: StarMan12 <author@example.com>
|
|
6
|
-
Project-URL: Homepage, https://github.com/SyperAlexKomp/simple-rule34-api
|
|
7
|
-
Project-URL: Bug Tracker, https://github.com/SyperAlexKomp/simple-rule34-api/issues
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.9
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Requires-Dist: aiohttp ==3.8.4
|
|
15
|
-
Requires-Dist: aiosignal ==1.3.1
|
|
16
|
-
Requires-Dist: alabaster ==0.7.13
|
|
17
|
-
Requires-Dist: async-timeout ==4.0.2
|
|
18
|
-
Requires-Dist: attrs ==23.1.0
|
|
19
|
-
Requires-Dist: Babel ==2.9.1
|
|
20
|
-
Requires-Dist: build ==0.10.0
|
|
21
|
-
Requires-Dist: certifi ==2023.5.7
|
|
22
|
-
Requires-Dist: charset-normalizer ==3.2.0
|
|
23
|
-
Requires-Dist: colorama ==0.4.6
|
|
24
|
-
Requires-Dist: docopt ==0.6.2
|
|
25
|
-
Requires-Dist: docutils ==0.18.1
|
|
26
|
-
Requires-Dist: frozenlist ==1.4.0
|
|
27
|
-
Requires-Dist: idna ==3.4
|
|
28
|
-
Requires-Dist: imagesize ==1.4.1
|
|
29
|
-
Requires-Dist: importlib-metadata ==6.8.0
|
|
30
|
-
Requires-Dist: Jinja2 ==3.1.2
|
|
31
|
-
Requires-Dist: MarkupSafe ==2.1.3
|
|
32
|
-
Requires-Dist: multidict ==6.0.4
|
|
33
|
-
Requires-Dist: packaging ==23.1
|
|
34
|
-
Requires-Dist: pipreqs ==0.4.13
|
|
35
|
-
Requires-Dist: Pygments ==2.15.1
|
|
36
|
-
Requires-Dist: pyproject-hooks ==1.0.0
|
|
37
|
-
Requires-Dist: requests ==2.31.0
|
|
38
|
-
Requires-Dist: snowballstemmer ==2.2.0
|
|
39
|
-
Requires-Dist: Sphinx ==6.2.1
|
|
40
|
-
Requires-Dist: sphinx-rtd-theme ==1.2.2
|
|
41
|
-
Requires-Dist: sphinxcontrib-applehelp ==1.0.4
|
|
42
|
-
Requires-Dist: sphinxcontrib-devhelp ==1.0.2
|
|
43
|
-
Requires-Dist: sphinxcontrib-htmlhelp ==2.0.1
|
|
44
|
-
Requires-Dist: sphinxcontrib-jquery ==4.1
|
|
45
|
-
Requires-Dist: sphinxcontrib-jsmath ==1.0.1
|
|
46
|
-
Requires-Dist: sphinxcontrib-qthelp ==1.0.3
|
|
47
|
-
Requires-Dist: sphinxcontrib-serializinghtml ==1.1.5
|
|
48
|
-
Requires-Dist: tomli ==2.0.1
|
|
49
|
-
Requires-Dist: urllib3 ==2.0.3
|
|
50
|
-
Requires-Dist: yarg ==0.1.9
|
|
51
|
-
Requires-Dist: yarl ==1.9.2
|
|
52
|
-
Requires-Dist: zipp ==3.16.2
|
|
53
|
-
Requires-Dist: aiofiles ~=23.2.1
|
|
54
|
-
Requires-Dist: pydantic ~=2.7.1
|
|
55
|
-
|
|
56
|
-
# rule34-simple-api
|
|
57
|
-
Simple api wrapper of rule34.xxx for python with asynchronous support
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
SimpleRule34/Rule34.py,sha256=yVgZFMuCyC8VHbhxDWO37DnMvodkh9d8RYNRVtaHnIk,5433
|
|
3
|
-
SimpleRule34/__init__.py,sha256=C4IbcJ_rjqBhpENXImVGuEQxf81GUwNaycqNNAY_ROc,31
|
|
4
|
-
SimpleRule34/exceptions.py,sha256=dUpJBROzXWT67ZOLAHWWse0srvMRunIa9rSl1Cs10B8,491
|
|
5
|
-
SimpleRule34/setup.py,sha256=7hNDTD52EAs7W00-Nd5LzvH8H4-Dvc59W8a999LqvW4,735
|
|
6
|
-
SimpleRule34/types.py,sha256=n9y60b96g9wyD8FAZ_ElETBFNnM1F1GAs5VoxzCFI68,1518
|
|
7
|
-
SimpleRule34/utils.py,sha256=fWx-ntJ672NoktH5Ws9-FcO0gtCNVmd8VfxFxjWqsD0,616
|
|
8
|
-
SimpleRule34/aio/ARule34.py,sha256=nZwxmMNo_g_a16U9dJmxFGUIkDtgNB-W0uFH8LJ8tSI,6858
|
|
9
|
-
SimpleRule34/aio/types.py,sha256=919XQt5ydRoLeVxy5HRujc0IeKYlD3crYuH_qvPqdKY,3719
|
|
10
|
-
SimpleRule34/aio/utils.py,sha256=fWx-ntJ672NoktH5Ws9-FcO0gtCNVmd8VfxFxjWqsD0,616
|
|
11
|
-
simple_rule34-0.1.6.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
12
|
-
simple_rule34-0.1.6.dist-info/METADATA,sha256=dDBVIIRhZOzlaayIKolcj74YeEzKpsdGWWPi5bhQ_44,2154
|
|
13
|
-
simple_rule34-0.1.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
14
|
-
simple_rule34-0.1.6.dist-info/top_level.txt,sha256=YI-Z1ijzIjlJw2WeM95PSmClCzIvm24KAlyZi80YVNs,22
|
|
15
|
-
simple_rule34-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|