Socket
Socket
Sign inDemoInstall

500px-api

Package Overview
Dependencies
5
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    500px-api

This is an unofficial package to fetch photos, users, photographers, camera equipment details, and other information from the 500px.com website.


Version published
Maintainers
1
Install size
1.03 MB
Created

Readme

Source

500px-API

CI Code Coverage NPM Downloads NPM License
CodeFactor Maintainability Known Vulnerabilities Commitizen friendly Contributing

500px API is an unofficial package to fetch photos, users, photographers, camera equipment details, and other information from the 500px.com website!

When will it be ready?

Who knows?

Table of contents

What is 500px?

500px (pronounced "five hundred p-x") is a photography community where you can get immediate exposure with your first upload, connect and share your photos with the world, and grow as a photographer from anywhere.

Why 500px-api?

According to this support post, they no longer provide official API to third-parties.

The history of 500px has always encouraged creative development, but as of January 24th 2018, 500px will no longer be offering free access to our API. This decision was made in order to protect our assets and improve our website's performance. On June 15th, access to the API was shut down. This is part of a larger strategic shift focusing our energy on continuing to build the world’s best photography community at 500px.com.

That's the main reason I developed and publish this package.

🔼 jump to the top

Features

  • Proxy support
  • Random User-Agent header for each Client

Coverage

  • Photo
    • Discover
    • Search
    • Comments

Installing

Using yarn (recommended):

yarn add 500px-api

Using npm:

npm install 500px-api

Get started

See the examples subdirectory for simple API calls.

If you have a use-case in mind which isn't well-represented by the examples, please create an issue or submit a Pull Request.

🔼 jump to the top

Method Options

Each method has a lot of options, and some of them require pre-context.

First, I'll describe what those options are and the best practices to use them in your application.

🔼 jump to the top

Categories

Categories of photos may be specified by their ID or string name, depending on the API method.

Avoid hard coding these IDs and names in your application! ⚠️

The best practice to use them in method options, is using Category enum.

If you use this coding approach, in case if we change their values in the future, you no longer need to update your code, and this further ensures the stability of your code.

import { Category } from '500px-api';

/**
 * Return the String name of the category.
 */
console.log(Category.FAMILY); // Family

Sometimes after sending an API call, you might want to convert the category's numeric IDs to human-readable names, by using CategoriesHelper class.

import { CategoriesHelper } from '500px-api';

/**
 * Converts Numeric category ID to it's name.
 */
console.log(CategoriesHelper.convertIdToName(20)); // Family
IDNameEnum Usage
10AbstractCategory.ABSTRACT
29AerialCategory.AERIAL
11AnimalsCategory.ANIMALS
5Black and WhiteCategory.BLACK_AND_WHITE
1CelebritiesCategory.CELEBRITIES
15CommercialCategory.COMMERCIAL
16ConcertCategory.CONCERT
20FamilyCategory.FAMILY
14FashionCategory.FASHION
2FilmCategory.FILM
24Fine ArtCategory.FINE_ART
23FoodCategory.FOOD
3JournalismCategory.JOURNALISM
8LandscapesCategory.LANDSCAPES
12MacroCategory.MACRO
18NatureCategory.NATURE
30NightCategory.NIGHT
7PeopleCategory.PEOPLE
19Performing ArtsCategory.PERFORMING_ARTS
9City & ArchitectureCategory.CITY_AND_ARCHITECTURE
17SportCategory.SPORT
6Still LifeCategory.STILL_LIFE
21StreetCategory.STREET
26TransportationCategory.TRANSPORTATION
13TravelCategory.TRAVEL
22UnderwaterCategory.UNDERWATER
27Urban ExplorationCategory.URBAN_EXPLORATION
25WeddingCategory.WEDDING
0UncategorizedCategory.UNCATEGORIZED

🔼 jump to the top

Hidden categories

For several reasons, such as the type of audience or having an NSFW tag, the 500px.com website keeps these categories hidden from the public eye.

You can use these IDs and names the same way as usual categories, but you have to be aware the content is for mature users.

IDNameEnum Usage
31BoudoirCategory.BOUDOIR
4NudeCategory.NUDE

🔼 jump to the top

Image sizes

To fetch images of different sizes, you have to provide an array of numeric IDs as a method option. Each of these IDs represents different image sizes.

Avoid hard coding these IDs in your application! ⚠️

The best practice to use them in method options, is using ImageSize enum.

import { ImageSize } from '500px-api';

console.log(ImageSize.STANDARD_WIDTH_4096); // 15

I have no idea what the K, and S columns are stands for, but I implemented them in this package and the documentation anyway. If you have any more information about them, feel free to open a new issue to explain them.

🔼 jump to the top

Standard sizes

If the width or height is empty, it means that they'll be calculated automatically (consider it as auto).

import { ImageSize } from '500px-api';

const sizes = [
  // Standard width
  ImageSize.STANDARD_WIDTH_1000_Q50,
  ImageSize.STANDARD_WIDTH_2000_Q75,
  ImageSize.STANDARD_WIDTH_4096,

  // Standard height
  ImageSize.STANDARD_HEIGHT_300_Q80,
  ImageSize.STANDARD_HEIGHT_300,
  ImageSize.STANDARD_HEIGHT_450_Q80,
  ImageSize.STANDARD_HEIGHT_450_Q50,
  ImageSize.STANDARD_HEIGHT_600_Q80,
  ImageSize.STANDARD_HEIGHT_600,
  ImageSize.STANDARD_HEIGHT_1080,
];
IDWidthHeightQualityKSWatermarkEnum Usage
23100050✖️ImageSize.STANDARD_WIDTH_1000_Q50
24200075✖️ImageSize.STANDARD_WIDTH_2000_Q75
154096✔️✖️ImageSize.STANDARD_WIDTH_4096
3230080✖️ImageSize.STANDARD_HEIGHT_300_Q80
20300✖️ImageSize.STANDARD_HEIGHT_300
3145080✖️ImageSize.STANDARD_HEIGHT_450_Q80
2245050✖️ImageSize.STANDARD_HEIGHT_450_Q50
3360080✔️✖️ImageSize.STANDARD_HEIGHT_600_Q80
21600✔️✖️ImageSize.STANDARD_HEIGHT_600
61080✔️✖️ImageSize.STANDARD_HEIGHT_1080

🔼 jump to the top

Longest edge sizes

Depending on the overall height and width of the image, the longest edge of the image will be set to the Longest Edge column's value, and the other edge will be considered as auto.

import { ImageSize } from '500px-api';

const sizes = [
  // Longest edge
  ImageSize.LONGEST_EDGE_256,
  ImageSize.LONGEST_EDGE_900,
  ImageSize.LONGEST_EDGE_900_WATERMARK,
  ImageSize.LONGEST_EDGE_1000_Q80,
  ImageSize.LONGEST_EDGE_1080,
  ImageSize.LONGEST_EDGE_1170,
  ImageSize.LONGEST_EDGE_1500_Q80,
  ImageSize.LONGEST_EDGE_1600,
  ImageSize.LONGEST_EDGE_2000_Q80,
  ImageSize.LONGEST_EDGE_2048,
  ImageSize.LONGEST_EDGE_4096,
];
IDLongest EdgeQualityKSWatermarkEnum Usage
30256✖️ImageSize.LONGEST_EDGE_256
4900✖️ImageSize.LONGEST_EDGE_900
14900✔️✔️✔️ImageSize.LONGEST_EDGE_900_WATERMARK
34100080✔️✖️ImageSize.LONGEST_EDGE_1000_Q80
10801080✔️✖️ImageSize.LONGEST_EDGE_1080
51170✔️✖️ImageSize.LONGEST_EDGE_1170
35150080✔️✖️ImageSize.LONGEST_EDGE_1500_Q80
16001600✔️✖️ImageSize.LONGEST_EDGE_1600
36200080✔️✖️ImageSize.LONGEST_EDGE_2000_Q80
20482048✔️✖️ImageSize.LONGEST_EDGE_2048
40964096✔️✖️ImageSize.LONGEST_EDGE_4096

🔼 jump to the top

Cropped sizes

Regardless of the original size of the photo, they will be cropped and will never be larger than the specified size.

import { ImageSize } from '500px-api';

const sizes = [
  // Cropped
  ImageSize.CROPPED_70x70,
  ImageSize.CROPPED_100x100,
  ImageSize.CROPPED_140x140_Q50,
  ImageSize.CROPPED_200x200,
  ImageSize.CROPPED_280x280,
  ImageSize.CROPPED_440x440,
  ImageSize.CROPPED_580x580,
  ImageSize.CROPPED_600x600,
  ImageSize.CROPPED_680x680,
];
IDWidthHeightQualitySWatermarkEnum Usage
17070✖️ImageSize.CROPPED_70x70
100100100✖️ImageSize.CROPPED_100x100
214014050✖️ImageSize.CROPPED_140x140_Q50
200200200✖️ImageSize.CROPPED_200x200
3280280✖️ImageSize.CROPPED_280x280
440440440✖️ImageSize.CROPPED_440x440
11580580✔️✖️ImageSize.CROPPED_580x580
600600600✖️ImageSize.CROPPED_600x600
13680680✔️✖️ImageSize.CROPPED_680x680

🔼 jump to the top

Contributing

Please read the CONTRIBUTING.md file for details on our code of conduct, the process of running tests, and submitting pull requests to us.

🔼 jump to the top

Resources

🔼 jump to the top

Keywords

FAQs

Last updated on 27 Nov 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc