Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/viperadnan-git/wallpaper-api

An api which can use different sites to scrape images and serve them through API
https://github.com/viperadnan-git/wallpaper-api

deta fastapi heroku wallpaper wallpaper-api wallpaper-changer

Last synced: 2 months ago
JSON representation

An api which can use different sites to scrape images and serve them through API

Awesome Lists containing this project

README

        


Wallpapers API


An api which can use different sites to scrape images and serve them through API

**This API can be used for setting daily wallpapers on a mobile device by combining it with an app such as IFTTT**

## Installation

This is an ASGI server built using FastAPI. Here are some PaaS which is supported and you can deploy directly by clicking on the link below.

[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?repo=https://github.com/viperadnan-git/wallpaper-api)

Deploy

Or you can install it on your private server, the steps are given below.

### Installing Prerequisite
This project is written on python. Hence, install python-3.8.6 or later, see [`runtime.txt`](./runtime.txt) for exact version.

On Ubuntu-18.04 or later
```sh
apt-get install -y python3 python3-pip
```

### Installing Python Packages
Install the required packages using pip
```sh
pip install -r requirements.txt
```

### Configuration

**Wallpaper website**

By default, it's scrapes wallpapers from . You can configure your desired wallpapers site's url and scraping regex in [`config.json`](./config.json)

**Collections**

This app uses collections name from [`collections.txt`](collections.txt) to fetch wallpapers from website and this list can be updated (as new collections arriving daily) by running the collection [`scraper`](scrape_collections.py). It have two modes, add collection from search or automaticaly fetch all collections.

_Note: Random wallpaper feature didn't work if collections file is empty so we added some nice collections already. You can remove file and add your own desired collections_
```sh
python3 scrape_collections.py
```
This will fetch and update the collection file automatically.

### Start Server
Start the ASGI server using **uvicorn**
```sh
uvicorn main:app
```

If using a VPS then set the host and port accordingly
```sh
uvicorn main:app --host 0.0.0.0 --port 80
```

[`Procfile`](./Procfile) already exists if you want to deploy it on railway or heroku etc.

## Copyright & License

Copyright (©) 2022 by [Adnan Ahmad](https://github.com/viperadnan-git).
Licensed under the terms of the [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007](./LICENSE)