# FALocalRepo
[![version_pypi](https://img.shields.io/pypi/v/falocalrepo?logo=pypi)](https://pypi.org/project/falocalrepo/)
[![version_gitlab](https://img.shields.io/badge/dynamic/json?logo=gitlab&color=orange&label=gitlab&query=%24%5B%3A1%5D.name&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2Fmatteocampinoti94%252Ffalocalrepo%2Frepository%2Ftags)](https://gitlab.com/MatteoCampinoti94/FALocalRepo)
[![version_python](https://img.shields.io/pypi/pyversions/falocalrepo?logo=Python)](https://www.python.org)
[![issues_gitlab](https://img.shields.io/badge/dynamic/json?logo=gitlab&color=orange&label=issues&suffix=%20open&query=%24.length&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2Fmatteocampinoti94%252Ffalocalrepo%2Fissues%3Fstate%3Dopened)](https://gitlab.com/MatteoCampinoti94/FALocalRepo/issues)
[![issues_github](https://img.shields.io/github/issues/matteocampinoti94/falocalrepo?logo=github&color=blue)](https://github.com/MatteoCampinoti94/FALocalRepo/issues)
Pure Python program to download any user's gallery/scraps/favorites from the FurAffinity forum in an easily handled database.
## Introduction
This program was born with the desire to provide a relatively easy-to-use method for FA users to download submissions that they care about from the forum.
The data is stored into a SQLite database, and the submissions files are saved in a tiered tree structure based on their ID's. Using SQLite instead of a client-server database makes the program to be extremely portable, only needing a working Python 3.8+ installation to work, and allows the downloaded data to be moved and backed up by simply moving/copying the database file and submission files folder.
All download operations are performed through the custom FurAffinity scraping library [faapi](https://pypi.org/project/faapi/). To ensure proper crawling behavior the library strictly follows FurAffinity's [robots.txt](https://www.furaffinity.net/robots.txt) in regard to allowed paths and crawl delay. Furthermore, submission files downloads are throttled to 100 KB/s to ensure the program won't use too much bandwidth.
The database and file-storage functions are handled independently by the [falocalrepo-database](https://pypi.org/project/falocalrepo-database/) package which performs all transactions, queries, and file operations.
The [falocalrepo-server](https://pypi.org/project/falocalrepo-server/) package is used to provide the server functionalities of the program.
## Contents
1. [Installation and Update](#installation-and-update)
1. [Cookies](#cookies)
1. [Usage](#usage)
1. [Environmental Variables](#environmental-variables)
1. [Help](#help)
1. [Init](#init)
1. [Configuration](#configuration)
1. [Download](#download)
1. [Database](#database)
1. [Database](#database-1)
1. [Settings](#settings)
1. [Users](#users)
1. [Submissions](#submissions)
1. [Journals](#journals)
1. [Submission Files](#submission-files)
1. [Upgrading Database](#upgrading-database)
1. [Contributing](#contributing)
1. [Issues](#issues)
1. [Appendix](#appendix)
## Installation and Update
To install the program it is sufficient to use Python pip and get the package `falocalrepo`.
```shell
python3 -m pip install falocalrepo
```
Python 3.8 or above is needed to run this program, all other dependencies are handled by pip during installation. For information on how to install Python on your computer, refer to the official website [Python.org](https://www.python.org/).
To upgrade the `falocalrepo` and its dependencies, use pip to upgrade all three components.
```shell
python3 -m pip install --upgrade falocalrepo faapi falocalrepo-database falocalrepo-server
```
To check for updates use the `--updates` option when launching the program. A message will be if there is an update available for any component.
The program needs cookies from a logged-in FurAffinity session to download protected pages. Without the cookies the program can still download publicly available pages, but others will return empty. See [#Cookies](#cookies) for more details on which cookies to use.
**Warning**: FurAffinity theme template must be set to "modern". Can be changed at [furaffinity.net/controls/settings/](https://www.furaffinity.net/controls/settings/).
## Cookies
The scraping library used by this program needs two specific cookies from a logged-in FurAffinity session. These are cookie `a` and cookie `b`.
As of 2020-08-09 these take the form of hexadecimal strings like `356f5962-5a60-0922-1c11-65003b703038`.
The easiest way to obtain these cookies is by using a browser extension to extract your cookies and then search for `a` and `b`.<br>
Alternatively, the storage inspection tool of a desktop browser can also be used. For example on Mozilla's Firefox this can be opened with the ⇧F9 shortcut.
To set the cookies use the `config cookies` command. See [#Configuration](#configuration) for more details.
## Usage
> **How to Read Usage Instructions**
> * `command` a static command keyword
> * `<arg>` `<param>` `<value>` an argument, parameter, value, etc... that must be provided to a command
> * `[<arg>]` an optional argument that can be omitted
> * `<arg1> | <arg2>` mutually exclusive arguments, only use one
To run the program, simply call `falocalrepo` in your shell after installation.
Running without arguments will prompt a help message with all the available options and commands.
The usage pattern for the program is as follows:
```
falocalrepo [-h | -v | -d | -s | -u] [<command> [<operation>] [<arg1> ... <argN>]]
```
Available options are:
* `-h, --help` show help message
* `-v, --version` show program version
* `-d, --database` show database version
* `-s, --server` show server version
* `-u, --updates` check for updates on PyPi
Available commands are:
* `help` display the manual of a command
* `init` create the database and exit
* `config` manage settings
* `download` perform downloads
* `database` operate on the database
_Note:_ all the commands except `help` will create and initialise the database if it is not present in the folder
_Note:_ only one instance of the program is allowed at any given time
When the database is first initialised, it defaults the submissions files folder to `FA.files`. This value can be changed using the [`config` command](#configuration).
Cookies need to be set manually with the config command before the program will be able to access protected pages.
### Environmental Variables
`falocalrepo` supports the following environmental variables:
* `FALOCALREPO_DATABASE` sets a path for the database rather than using the current folder. If the path basename ends with `.db` -- e.g. `~/Documents/FA/MyFA.db` -- , then a database file will be created/opened with that name. Otherwise, the path will be considered a folder, and a database named "FA.db" will be created therein.
* `FALOCALREPO_DEBUG` always print traceback of caught exceptions, regardless of whether they are known or not.
### Help
`help [<command> [<operations>]]`
The `help` command gives information on the usage of the program and its commands and operations.
```
falocalrepo help
```
```
falocalrepo help download
```
```
falocalrepo help database search-users
```
### Init
The `init` command initialises the database or, if one is already present, updates to a new version - if available - and then exits.
It can be used to create the database and then manually edit it, or to update it to a new version without calling other commands.
### Configuration
`config [<setting> [<value1>] ... [<valueN>]]`
The `config` command allows to change the settings used by the program.
Running the command alone will list the current values of the settings stored in the database. Running `config <setting>` without value arguments will show the current value of that specific setting.
Available settings are:
* `list` list stored settings.
* `cookies [<cookie1 name>=<cookie1 value>] ... [<cookieN name>=
PyPI 官网下载 | falocalrepo-3.16.2.tar.gz
版权申诉
117 浏览量
2022-01-31
21:41:16
上传
评论
收藏 32KB GZ 举报
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
最新资源
- Python3实现基于ARIMA模型来预测茅台股票价格趋势(数据集+代码).rar
- 黑色简洁的PHP短网址短链接生成源码.rar
- dbeaver-ce-24.0.5-x86-64-setup.zip
- hfm (1).cpp
- 数据分析案例-数据科学相关岗位薪资可视化分析(数据集+代码).rar
- PSO-SDAE基于粒子群优化堆叠去噪自编码器的数据回归预测多变量回归预测(Matlab完整源码和数据)
- 基于卷积神经网络MobileNet 的情感识别源码.7z
- 一个很好的elasticsearchJavarest客户端 它以类似于mybatis的方式操作和访问elasticsearch
- student.sql
- 一个简单的卷积神经网络(Convolutional Neural Network, CNN)示例
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈