GithubHelp home page GithubHelp logo

b3yc0d3 / rule34py Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 4.0 99 KB

python api wrapper for rule34.xxx rest api

Home Page: https://pypi.org/project/rule34Py/

License: GNU General Public License v3.0

Python 100.00%
api-client nsfw-api python-3 rule34-api rule34api rule34xxx adults-only

rule34py's People

Contributors

b3yc0d3 avatar miningxl avatar redstonedlife avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rule34py's Issues

Search non-functional?

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?

How do you get any image after the 100th in a search?

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.

Search limit

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

PostComment.creation returns incorrect timestamp

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 [...]
[...]

search have an option random

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)

Page_id in search function does nothing

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

make random_post print more than 1 result.

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?

_random_post_id() returns KeyError: 'id'

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.

Random fonction broken

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

Error

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'))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.