b3yc0d3 / rule34py Goto Github PK
View Code? Open in Web Editor NEWpython api wrapper for rule34.xxx rest api
Home Page: https://pypi.org/project/rule34Py/
License: GNU General Public License v3.0
python api wrapper for rule34.xxx rest api
Home Page: https://pypi.org/project/rule34Py/
License: GNU General Public License v3.0
Example .py:
from __future__ import absolute_import, division, print_function, unicode_literals
from rule34Py import rule34Py
r34 = rule34Py()
image = r34.search("slime")
print(image)
Result:
[{'id': None, 'score': None, 'rating': None, 'creator_id': None, 'created_at': None, 'source': (None,), 'has_notes': None, 'tags': None, 'img_sample_url': None, 'img_file_url': None, 'img_preview_url': None}]
Anything I'm missing?
title says it
here's my code:
if post.file_type == "video":
links += f"[{i + 1}] This is a video! Click on the Source button to see it on r34!\n"
I tried searching for a particular tag:
search = r34.search(["miruko"], limit=100, page_id=1)
Yet the limit can only go up to 100, and the page id does not change in any way the resulting links I get from the search. How do I get any image other than the first 100?
Thanks.
Hello, i want more than 1000 posts in the random_post command but even if i use the ignore_max_limit in the search command the command give me a maximum of 1000 posts
a=r3.search(["ass"], limit=2000,ignore_max_limit=True)
for i in a:
print(i.id)
print(len(a))
len(a)=1000
Greetings!
It seems that PostComment.creation
is the time when the comment was obtained/fetched by get_comments()
rather than the time the comment was created/posted.
(though the time is slightly offset, presumably because it uses UTC time, and I am on UTC +2.)
code to reproduce the bug:
Python: 3.10.2
from rule34Py import rule34Py
r34Py = rule34Py()
print(r34Py.version) # 1.4.10
comments = r34Py.get_comments(1)
for comment in comments:
print(f"{comment.creation}\t{comment.body}")
output:
1.4.10
2023-06-21 19:30 I feel like I [...]
2023-06-21 19:30 Dropping by [...]
2023-06-21 19:30 Welcome to the first [...]
[...]
Hello, I have a question: why doesn't the search have an option to random, or why doesn't the random_post have an option to set a limit?
(sorry no speak inglish)
if i run this code:
r34py = rule34Py()
result1 = r34py.search(tags=['video'], page_id=1)
result2 = r34py.search(tags=['video'], page_id=2)
print(result1[0].id) # prints 7165822
print(result2[0].id) # prints 7165822
the same id will be printed twice even though a different page_id is used
not sure what this is caused by but its probably a typo
using version 1.4.8
tried to do a loop:
results = []
for i in range(5):
result = r34Py.random_post(["sexy"])
results.append(result.image)
for url in results:
print(url)
but that is slow. Can anyone help?
So I'm using rule34Py 1.4.6 (hopefully the latest cause I downloaded it using pip install)
When using rule34Py.random_post()
it will throw a KeyError: 'id'
exception from self._random_post_id()
now I went through the code
the simplest fix is to use __base_url__
in RANDOM_POST
instead of __api_url__
because rule34 uses the base url for random posts not the API. That fixes the issue at hand.
hello there,
So I think I found a bug in the random function.
Imagine doing a search that result in only 2 posts, then, the posts starts at id=0 and not id=1.
When using the randint(), we need to start at 0 and finish at "self.search(tags, 0, 0)[0] - 1" the search return 2 posts, but the id are 0 and 1
Current code:
if tags != None:
rand_num = random.randint(1, self.search(tags, 0, 0)[0])
return self.search(tags, rand_num, 1)[1]
"Fixed code:
if tags != None:
rand_num = random.randint(0, self.search(tags, 0, 0)[0]-1)
return self.search(tags, rand_num, 1)[1]
In the current state, if we do a search with only 2 images, it break the script half the time, the other half, it return the image with id=1.
I'm bad at explaining stuff, I hope that I made it (approximately) clear.
You can try this search term (what I used) : "calmadman" https://rule34.xxx/index.php?page=post&s=list&tags=calmadman
Returns error
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.rule34.xxx', port=443): Max retries exceeded with url: /index.php?page=dapi&s=comment&q=index&post_id=4153825 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f59b348d9a0>: Failed to establish a new connection: [Errno 111] Connection refused'))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.