A book uploader bot that transfers documents from public libraries such as Google Books, Punjab Digital Library and Trove Digital Library to Internet Archive. Built for Wikimedia Tool Labs. Check out BUB2 on Toolforge!
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Clone the repository
git clone https://github.com/coderwassananmol/BUB2
- Navigate to the project directory on the terminal:
cd BUB2
. - For developers, checkout to develop branch:
git checkout develop
- Run
npm install
Rename .env.example
to .env
. Then, to fill the credentials,
-
Make an account on archive.org.
-
Go to https://archive.org/account/s3.php . Generate the access and secret keys and fill them in the
.env
file in the corresponding fields. -
Go to Google Developers console. Make a new project to run the app. In that Google Developers project, search for 'Books API' in the Google API console, then enable the API for the project, then generate the API keys, and then copy and paste the API key in the
GB_Key
field. -
Enter the
redishost
field. If it's hosted locally, enter 127.0.0.1, which is the default localhost. -
Enter the
redisport
field with 6379, which is the default port number for redis. -
You need Beta wiki OAuth 2.0 credentials to login with MediaWiki during development. Steps to obtain the OAuth credentials for the
WIKIMEDIA_CLIENT_ID
andWIKIMEDIA_CLIENT_SECRET
fields :- Go to Beta-wiki and click Request a token for a new OAuth 2.0 client.
- Enter the details (Application name, details, callback url, and applicable grants). Refer this as a sample.
- After submitting, note the client application key and client application secret and wait for the proposed consumer to get approved.
- Go to this file.
- Add the following code after the clientId and clientSecret :
token: "https://meta.wikimedia.beta.wmflabs.org/w/rest.php/oauth2/access_token", userinfo: "https://meta.wikimedia.beta.wmflabs.org/w/rest.php/oauth2/resource/profile", authorization: { url: "https://meta.wikimedia.beta.wmflabs.org/w/rest.php/oauth2/authorize", params: { scope: "" }, }
-
Enter the client application key and client application secret in the
WIKIMEDIA_CLIENT_ID
andWIKIMEDIA_CLIENT_SECRET
respectively. -
Enter the
NEXTAUTH_URL
with http://localhost:5000.
- Refer to Redis for download and setup documentation
- Run
npm run dev
for development andnpm run start
for production. - Open your browser and navigate to http://localhost:5000
Please read CONTRIBUTING.md for information on how to contribute to BUB2.
- Fork the repository.
- Clone the repository to your local system by using the command :
git clone "https://github.com/<YOUR_USERNAME>/BUB2"
. - The issues are maintained on Phabricator.
- Assign an issue to yourself from Phabricator.
- Create a new branch and start working on the issue locally.
- Create a PULL REQUEST to merge your branch with the main branch and mention the Phab task in the description.
- The issue will be considered closed and resolved once the PR is accepted. Please read CONTRIBUTING.md for information on how to contribute to BUB2.
We actively welcome pull requests. Learn how to contribute.
There was no Node.js wrapper available for Internet Archive, so I decided to write the Node implementation to upload books to Internet Archive. If you like this repository, show your support by starring the project. Cheers!
Please read license for more information.