Topic: [Feature] API - if post is in pool, get pool ID

Posted under Site Bug Reports & Feature Requests

Requested feature overview description.

Using the api to show all details of a post https://e621.net/post/show.json does not show 1) if the post is in a pool 2) what id that pool would then have.

As of 2019-08-07, the information you can get for a post is: id, tags, locked_tags, description, created_at, creator_id, author, change, source, score, fav_count, md5, file_size, file_url, file_ext, preview_url, preview_width, preview_height, sample_url, sample_width, sample_height, rating, status, width, height, has_comments, has_notes, has_children, children, parent_id, artist, sources

Why would it be useful?

Sorting downloaded posts automatically in corresponding folders when using the API.

What part(s) of the site page(s) are affected?

post/show and post/index API

Updated by NotTheZorro

inbox said:
Requested feature overview description.

Using the api to show all details of a post https://e621.net/post/show.json does not show 1) if the post is in a pool 2) what id that pool would then have.

As of 2019-08-07, the information you can get for a post is: id, tags, locked_tags, description, created_at, creator_id, author, change, source, score, fav_count, md5, file_size, file_url, file_ext, preview_url, preview_width, preview_height, sample_url, sample_width, sample_height, rating, status, width, height, has_comments, has_notes, has_children, children, parent_id, artist, sources

Why would it be useful?

Sorting downloaded posts automatically in corresponding folders when using the API.

What part(s) of the site page(s) are affected?

post/show and post/index API

my solution for python is to use urllib3 and BeautifulSoup:

try:
    http = urllib3.PoolManager(headers={'User-Agent': "e621 pool parser"}
    pool_url = BeautifulSoup(http.request(
        'GET', 'https://e621.net/post/show/{}'.format(result['id'])).data, 'html.parser') \
        .find('div', {'class': 'sidebar'}) \
        .find('div', {'class': 'status-notice'}).find('a', href=True)['href']
    if 'pool' not in pool_url:
        pool_url = None
except AttributeError:
    pool_url = None

Updated by anonymous

  • 1