Skip to main content
100%

OpenAlex-url to pyalex-query

✓ Published0🌍 Public
MMNoichl
Last edited Mar 17, 2025
Created on Mar 17, 2025

This example shows how to convert an OpenAlex search URL into a query object and parameters for the pyalex API, then counts the matching works. The Python script parses the URL string with `urlparse` and `parse_qs`, extracting filters, sort orders, and pagination options. It builds the query by chaining methods on the `Works` object from pyalex, handling fields like `default.search` and `title_and_abstract.search`, and applies sort directions as asc or desc. Finally, it calls `query.count()` to return the total number of works that match the converted query.

AI-generated description

Similar vizzes