flickr-url-parser


Nameflickr-url-parser JSON
Version 1.8.3 PyPI version JSON
download
home_pageNone
SummaryEnter a Flickr URL, and find out what sort of URL it is (single photo, album, gallery, etc.)
upload_time2024-04-30 14:43:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords flickr
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```console
$ 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.

[Flinumeratr]: https://www.flickr.org/tools/flinumeratr/
[Flickypedia]: https://www.flickr.org/tools/flickypedia/
[Flickr Foundation]: https://www.flickr.org/

## 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:

    ```console
    $ 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:

    ```pycon
    >>> 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](https://docs.python.org/3/library/functions.html#help):

    ```pycon
    >>> 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](./CONTRIBUTING.md).

## Useful reading

-   Photo Image URLs in the Flickr docs: <https://www.flickr.com/services/api/misc.urls.html>

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "flickr-url-parser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Alex Chan <alex@flickr.org>",
    "keywords": "flickr",
    "author": null,
    "author_email": "Flickr Foundation <hello@flickr.org>",
    "download_url": "https://files.pythonhosted.org/packages/43/e6/e635fc1e18d081e89262c5d14adb2bea66280753f39858380835e46a12ee/flickr_url_parser-1.8.3.tar.gz",
    "platform": null,
    "description": "# flickr-url-parser\n\nThis is a library for parsing Flickr URLs.\nYou enter a Flickr URL, and it tells you what it points to \u2013 a single photo, an album, a gallery, and so on.\n\nExamples:\n\n```console\n$ flickr_url_parser \"https://www.flickr.com/photos/sdasmarchives/50567413447\"\n{\"type\": \"single_photo\", \"photo_id\": \"50567413447\"}\n\n$ flickr_url_parser \"https://www.flickr.com/photos/aljazeeraenglish/albums/72157626164453131\"\n{\"type\": \"album\", \"user_url\": \"https://www.flickr.com/photos/aljazeeraenglish\", \"album_id\": \"72157626164453131\", \"page\": 1}\n\n$ flickr_url_parser \"https://www.flickr.com/photos/blueminds/page3\"\n{\"type\": \"user\", \"user_url\": \"https://www.flickr.com/photos/blueminds\"}\n```\n\n## Motivation\n\nThere's a lot of variety in Flickr URLs, even among URLs that point to the same thing.\nFor example, all four of these URLs point to the same photo:\n\n```\nhttps://www.flickr.com/photos/sdasmarchives/50567413447\nhttp://flickr.com/photos/49487266@N07/50567413447\nhttps://www.flickr.com/photo.gne?id=50567413447\nhttps://live.staticflickr.com/65535/50567413447_afec74ef45_o_d.jpg\n```\n\nDealing with all these variants can be tricky \u2013 this library aims to simplify that.\nWe use it for [Flinumeratr], [Flickypedia], and other [Flickr Foundation] projects.\n\n[Flinumeratr]: https://www.flickr.org/tools/flinumeratr/\n[Flickypedia]: https://www.flickr.org/tools/flickypedia/\n[Flickr Foundation]: https://www.flickr.org/\n\n## Usage\n\nThere are two ways to use flickr_url_parser:\n\n1.  **As a command-line tool.**\n    Run `flickr_url_parser`, passing the Flickr URL as a single argument:\n\n    ```console\n    $ flickr_url_parser \"https://www.flickr.com/photos/sdasmarchives/50567413447\"\n    {\"type\": \"single_photo\", \"photo_id\": \"50567413447\"}\n    ```\n\n    The result will be printed as a JSON object.\n\n    To see more information about the possible return values, run `flickr_url_parser --help`.\n\n2.  **As a Python library.**\n    Import the function `parse_flickr_url` and pass the Flickr URL as a single argument:\n\n    ```pycon\n    >>> from flickr_url_parser import parse_flickr_url\n\n    >>> parse_flickr_url(\"https://www.flickr.com/photos/sdasmarchives/50567413447\")\n    {\"type\": \"single_photo\", \"photo_id\": \"50567413447\"}\n    ```\n\n    To see more information about the possible return values, use the [`help` function](https://docs.python.org/3/library/functions.html#help):\n\n    ```pycon\n    >>> help(parse_flickr_url)\n    ```\n\nNote that just because a URL can be parsed does not mean it can be *resolved* to a photo and/or photos.\nThe 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.\n\n## Development\n\nIf you want to make changes to the library, there are instructions in [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## Useful reading\n\n-   Photo Image URLs in the Flickr docs: <https://www.flickr.com/services/api/misc.urls.html>\n\n## License\n\nThis project is dual-licensed as Apache-2.0 and MIT.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Enter a Flickr URL, and find out what sort of URL it is (single photo, album, gallery, etc.)",
    "version": "1.8.3",
    "project_urls": {
        "Changelog": "https://github.com/Flickr-Foundation/flickr-url-parser/blob/main/CHANGELOG.md",
        "Homepage": "https://github.com/Flickr-Foundation/flickr-url-parser"
    },
    "split_keywords": [
        "flickr"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3087fab4d148b9412366d7405ec3052ae2a4e1e1871b411474c4c770861a1b6",
                "md5": "d0d5b6911217175c180232e11bb97670",
                "sha256": "962442b6d3e896a075d14dc0e95e1ca0f2a6afdaa25884e20bee1c2719204d1a"
            },
            "downloads": -1,
            "filename": "flickr_url_parser-1.8.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d0d5b6911217175c180232e11bb97670",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 15523,
            "upload_time": "2024-04-30T14:43:40",
            "upload_time_iso_8601": "2024-04-30T14:43:40.907960Z",
            "url": "https://files.pythonhosted.org/packages/d3/08/7fab4d148b9412366d7405ec3052ae2a4e1e1871b411474c4c770861a1b6/flickr_url_parser-1.8.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "43e6e635fc1e18d081e89262c5d14adb2bea66280753f39858380835e46a12ee",
                "md5": "271956b1966c6bb034aa137b5fa6a319",
                "sha256": "af8375525f1a850c9838f0772385f63999fad3f77db88637fb7f4bf315e47da9"
            },
            "downloads": -1,
            "filename": "flickr_url_parser-1.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "271956b1966c6bb034aa137b5fa6a319",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 19373,
            "upload_time": "2024-04-30T14:43:42",
            "upload_time_iso_8601": "2024-04-30T14:43:42.920210Z",
            "url": "https://files.pythonhosted.org/packages/43/e6/e635fc1e18d081e89262c5d14adb2bea66280753f39858380835e46a12ee/flickr_url_parser-1.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 14:43:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Flickr-Foundation",
    "github_project": "flickr-url-parser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flickr-url-parser"
}
        
Elapsed time: 0.28970s