Skip to content

Conversation

@395ShikharSingh
Copy link
Contributor

@395ShikharSingh 395ShikharSingh commented Jan 16, 2026

Issue Reference

Closes #11672

Summary

This PR implements a new Bulk Import feature that allows users to add multiple books to a list by:

  • Entering a URL containing book ISBNs
  • Pasting a list of ISBNs directly
  • Pasting Open Library Edition IDs

Files Changed

File Purpose
openlibrary/plugins/upstream/account.py Added bulk_import route class for /account/import/bulk
openlibrary/templates/account/import_bulk.html Template that loads the JS and initializes the UI
static/css/page-import-bulk.less Styles for the bulk import page
static/bookmarklets/isbn_importer_prototype.js Main JavaScript containing all the logic

Function Reference

Core ISBN/Edition Functions

Function Description
fetchWithProxy(url) Fetches external URLs through CORS proxies
extractIsbns(text) Extracts ISBN-10 and ISBN-13 from text using regex
isValidIsbn(isbn) Validates ISBN checksums
lookupEditions(isbns) Batch looks up ISBNs via Open Library Search API, returns edition objects with editionKey, title, coverId
importBooksFromUrl(url) Fetches a URL, extracts ISBNs, and looks them up
importBooksFromIsbns(input) Parses ISBN text input and looks them up

List Management Functions

Function Description
getLoggedInUsername() Detects logged-in user by checking /account redirect or parsing page
fetchUserLists(username) Fetches user's existing lists from /people/{username}/lists.json
createList(username, name, description) Creates a new list via POST to /people/{username}/lists
addEditionsToList(listKey, editions) Adds editions to a list via POST to {listKey}/seeds.json

Orchestration Functions (Console Usage)

Function Description
importAndAddToList(url, listName) Imports from URL and creates a new list
importAndAddToExistingList(url, listKey) Imports from URL and adds to existing list
showMyLists() Displays user's lists in console table

Screenshots

Screen.Recording-1.mov
Screen.Recording-2.mov

Note: I couldn’t test this URL feature locally, but I tested it on https://openlibrary.org/, and it worked.

Screen.Recording-3.mov

Stakeholders

@mekarpeles

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are accessibility issues in these changes.

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 You fixed the issue(s)! Great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prototype: Import Books from URL

1 participant