Skip to main content

flickr-url-parser

This is a library for parsing Flickr URLs. You enter a Flickr URL, and it tells you what it points to – a single photo, an album, a gallery, and so on.

Examples:

$ flickr_url_parser "https://www.flickr.com/photos/sdasmarchives/50567413447"
{"type": "single_photo", "photo_id": "50567413447"}

$ flickr_url_parser "https://www.flickr.com/photos/aljazeeraenglish/albums/72157626164453131"
{"type": "album", "user_url": "https://www.flickr.com/photos/aljazeeraenglish", "album_id": "72157626164453131", "page": 1}

$ flickr_url_parser "https://www.flickr.com/photos/blueminds/page3"
{"type": "user", "user_url": "https://www.flickr.com/photos/blueminds"}

Motivation

There's a lot of variety in Flickr URLs, even among URLs that point to the same thing. For example, all four of these URLs point to the same photo:

https://www.flickr.com/photos/sdasmarchives/50567413447
http://flickr.com/photos/49487266@N07/50567413447
https://www.flickr.com/photo.gne?id=50567413447
https://live.staticflickr.com/65535/50567413447_afec74ef45_o_d.jpg

Dealing with all these variants can be tricky – this library aims to simplify that. We use it for Flinumeratr, Flickypedia, and other Flickr Foundation projects.

Usage

There are two ways to use flickr_url_parser:

  1. As a command-line tool. Run flickr_url_parser, passing the Flickr URL as a single argument:

    $ flickr_url_parser "https://www.flickr.com/photos/sdasmarchives/50567413447"
    {"type": "single_photo", "photo_id": "50567413447"}
    

    The result will be printed as a JSON object.

    To see more information about the possible return values, run flickr_url_parser --help.

  2. As a Python library. Import the function parse_flickr_url and pass the Flickr URL as a single argument:

    >>> from flickr_url_parser import parse_flickr_url
    
    >>> parse_flickr_url("https://www.flickr.com/photos/sdasmarchives/50567413447")
    {"type": "single_photo", "photo_id": "50567413447"}
    

    To see more information about the possible return values, use the help function:

    >>> help(parse_flickr_url)
    

Note that just because a URL can be parsed does not mean it can be resolved to a photo and/or photos. The only way to know if there are photos behind the URL is to (1) try to fetch the URL or (2) use the output from the parser to ask the Flickr API for photos.

Development

If you want to make changes to the library, there are instructions in CONTRIBUTING.md.

Useful reading

License

This project is dual-licensed as Apache-2.0 and MIT.

Metadata

Release files for flickr-url-parser 1.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flickr-url-parser 1.12.0
File Size Uploaded
flickr_url_parser-1.12.0.tar.gz 21.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flickr-url-parser 1.12.0
File Interpreter ABI Platform
flickr_url_parser-1.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.0 kB

Release files / flickr_url_parser-1.12.0.tar.gz

Download URL flickr_url_parser-1.12.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2e2de7aee12a232fbfb07b04da232182b643683014e31d97aa3d8c82b8eb4a2c
BLAKE2b-256 checksum
How to use checksums
dc8baf4a7c345f61d69dd5b60e3587e01507a23640ce52f83e5e661d599d7a61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.13.1

Release files / flickr_url_parser-1.12.0-py3-none-any.whl

Download URL flickr_url_parser-1.12.0-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6e20ee97777468101bd6160be755df763f035cfcde873bf9baef4714db6cd35
BLAKE2b-256 checksum
How to use checksums
4916b745e4f2cc1e4e7b524668859a8fd71917dfd5fa0653b5984eed4e86310b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

1.12.0 This release

2 release files

1.9.0

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

1 release file

1.2.1

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page