Post feeds to GNU Social.
Project description
1 gnusrss
1.1 English
1.1.1 About
gnusrss parse feeds and post them to GNU Social. The idea of this program came from spigot, a program that posts feeds to the social network pump.io as does gnusrss but better, because it controls the possible flood. gnusrss does not have this option and it will be managed with the crontab (for now).
1.1.2 Features
Multiple feed and GNU Social accounts support
sqlite3 is used to store the feeds
Can fetch RSS files or url indistinctly
Twitter image upload support when used with twitter2rss
1.1.3 Requirements
Need a version equal to or greater than python 3 and some libraries:
feedparser >= 5.0
requests >= 2.11.1
1.1.4 Git repository
It’s in two places:
http://daemons.cf/cgit/gnusrss: the original repository
https://notabug.org/drymer/gnusrss/: A mirror in which it can be put issues and feature requests
1.1.5 Install
As with any program that uses python, it should be used a virtual environment (virtualenv), but that is user selectable. It’s possible to use one of the next installation methods:
Install via pip:
0 $ su -c "pip3 install gnusrss"
Clone the repository:
0$ git clone git://daemons.cf/gnusrss1# OR ...2$ git clone https://notabug.org/drymer/gnusrss/3$ cd gnusrss4$ su -c "pip3 install -r requirements.txt"5$ su -c "python3 setup.py install"
If on parabola:
0 $ su -c "pacman -S gnusrss"
1.1.6 Configuration
The program is (or should be) quite intuitive. Running the following, should show the basics:
0$ gnusrss.py1usage: gnusrss [-h] [-c file_name] [-C] [-p config_file] [-P] [-k file_name]23Post feeds to GNU Social45optional arguments:6-h, --help show this help message and exit7-c file_name, --create-config file_name8creates a config file9-C, --create-db creates the database10-p config_file, --post config_file11posts feeds12-P, --post-all posts all feeds13-k file_name, --populate-database file_name14fetch the RSS and save it in the database
In any case, if not clear, read the following.
For the first use, it must be created the database and the first configuration file. This can done using the same command, like this:
0 $ gnusrss.py --create-db --create-config daemons
Then it will ask several questions to create the first configuration file. It should look like this:
0Database created!1Hi! Now we'll create config file!2Please enter the feed's URL: https://daemons.cf/rss.xml3Please enter your username (user@server.com): drymer@quitter.se4Please enter your password: falsePassword5Do you need to shorten the URLs that you 'post? Please take in account6That You should only use it if your node only have 140 characters.7Answer with "yes" or just press enter if you do not want to use it:8Please enter your feed's fallbackurl. If you do not want or have one,9just press enter:10Now we're gona fetch the feed. Please wait ...11Done! The tags are:12tags13title_detail14link15authors16links17author_detail18published_parsed19title20summary21id22author23published24guidislink25summary_detail26The XML has-been parsed. Choose wich format you want:27Please put the tags inside the square brackets28Ex: {title} - {link} by @{author}: {title} - {link} by @{author}29Do you want to allow insecure connection to your GNU social server?30Answer with "yes" or just press enter if you don't want to use it:31Do you want to populate the database? (y) Or you prefer to post old items? (n)
The file is saved under the name ‘daemons.ini’. It should look like this:
0[Feeds]1feed = https://daemons.cf/rss.xml2user = drymer@quitter.se3password = falsePassword4shorten =5fallback_feed =6format = {title} - {link} by @ {author}
It can create all the configuration files you want. When creating the above file, it put into the database all the feeds that had so far. Thus, when running gnusrss for the first time, it will not post nothing to GNU Social until the feed has new information. To post feeds from a concrete config file or all execute, respectively, the following:
0$ gnusrss.py -p daemons.ini1$ gnusrss.py -P
If the config file is created manually and the user don’t want to post all the feed’s content, just use the –populate-database option to save them to the database:
0 $ gnusrss.py -k otherFile.ini
1.1.7 Crontab
The recommended way to execute gnurss is using the crontab. Each time it’s run, a single item of the feed will be posted to prevent flood. Depending on the number of feeds that are published, you should choose a different runtime. For a blog that publishs once a day, it could be used the following:
0$ crontab -e1# A file is open and gets the following2* 12 * * * cd $rutaDEgnusrss && gnusrss.py -p daemons.ini
So it runs once, every day at midday. If, however, it’s used with twitter2rss, it could be recommended putting it to run every five minutes. It has to be remembered that is important to run in the directory where the database was created, because is where it will search it..
1.1.9 License
0This program is free software: you can redistribute it and / or modify1it under the terms of the GNU General Public License as published by2the Free Software Foundation, Either version 3 of the License, or3(At your option) any later version.45This program is distributed in the hope That it will be useful,6but WITHOUT ANY WARRANTY; without even the implied warranty of7MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8GNU General Public License for more details.910You should have received a copy of the GNU General Public License11Along With This Program. If not, see <http://www.gnu.org/licenses/>.
1.2 Castellano
1.2.1 Acerca de
gnusrss parsea feeds y los postea en GNU Social. La idea de hacer este programa surgió de spigot, un programa que postea feeds en la red social pump.io igual que hace gnusrss pero mejor, ya que controla el posible flood. gnusrss no tiene esta opción y se controlará con el propio crontab (de momento).
1.2.2 Features
Soporta múltiples feeds y cuentas de GNU Social
sqlite3 es usado para guardar los feeds
Se puede usar tanto archivos RSS cómo url indistintamente
Soporta la súbida de imágenes de Twitter cuando es usado en conjunto con twitter2rss
1.2.3 Requisitos
Necesita una versión de python igual o superior a la 3 y algunas librerias:
feedparser >= 5.0
requests >= 2.11.1
1.2.4 Repositorio git
Está en dos sitios:
http://daemons.cf/cgit/gnusrss: el repositorio original
https://notabug.org/drymer/gnusrss/: un mirror, en el que se pueden poner los problemas y sugerencias de mejoras
1.2.5 Instalación
Cómo con cualquier programa con python, es recomendable usar un entorno virtual (virtualenv), pero eso queda a elección del usuario. Se puede escoger entre los siguientes metodos:
Instalar usando pip:
0 $ su -c "pip3 install gnusrss"
Clonar el repositorio:
0$ git clone git://daemons.cf/gnusrss1# O ...2$ git clone https://notabug.org/drymer/gnusrss/3$ cd gnusrss4$ su -c "pip3 install -r requirements.txt"5$ su -c "python3 setup.py install"
Si se usa parabola:
0 $ su -c "pacman -S gnusrss"
1.2.6 Configuración
El programa es (o debería ser) bastante intuitivo. Ejecutando lo siguiente, deberia verse lo básico:
0$ gnusrss.py1usage: gnusrss [-h] [-c file_name] [-C] [-p config_file] [-P] [-k file_name]23Post feeds to GNU Social45optional arguments:6-h, --help show this help message and exit7-c file_name, --create-config file_name8creates a config file9-C, --create-db creates the database10-p config_file, --post config_file11posts feeds12-P, --post-all posts all feeds13-k file_name, --populate-database file_name14fetch the RSS and save it in the database
En cualquier caso, si no queda claro, leer lo siguiente.
Para el primer uso, la base de datos y el primer archivo de configuración deben ser creados. Podemos hacerlo usando la misma orden, tal que así:
0 $ gnusrss.py --create-db --create-config daemons
A continuación hará varias preguntas para configurar el primer archivo de configuración. Debería verse así:
0Database created!1Hi! Now we'll create de config file!2Please introduce the feed's url: https://daemons.cf/rss.xml3Please introduce your username (user@server.com): drymer@quitter.se4Please introduce your password: contraseñaFalsa5{1}Do you need to shorten the urls that you post? Please take in account6that you should only use it if your node only has 140 characters.7Answer with "yes" or just press enter if you don't want to use it:8{2}Please introduce your feed's fallbackurl. If you don't want or have one,9just press enter:10Now we're gona fetch the feed. Please wait...11Done! The tags are:12tags13title_detail14link15authors16links17author_detail18published_parsed19title20summary21id22author23published24guidislink25summary_detail26The XML has been parsed. Choose wich format you want:27{3}Please put the tags inside the square brackets28Ex: {title} - {link} by @{author}: {title} - {link} by @{author}29{4}Do you want to allow insecure connection to your GNU social server?30Answer with "yes" or just press enter if you don't want to use it:31{5}Do you want to populate the database? (y) Or you prefer to post old items? (n)
A continuación traduciré las lineas con los números entre corchetes. {1} Necesitas acortar las url que quieres postear? Por favor ten en cuenta que sólo deberia usarse si el servidor sólo tiene 140 carácteres. {2} Por favor introduce tu feed de emergencia. Si no tienes uno, solamente aprieta enter. {3} Por favor pon las etiquetas dentro de los corchetes. {4} Quieres permitir conexiones inseguras a tu servidor GNU social? Responde con “si” o simplemente apreta enter si no necesitas usarlo. {5} Quieres llenar la base de datos? (y) O prefieres publicar los artículos antiguos? (n)
Respecto al 3, hay que examinar el código fuente del RSS para saber cuales interesan. En general, el que hay de ejemplo será lo que se busque. En el caso 4, sólo es útil si el servidor usa un certificado auto-firmado.
El archivo se guardará con el nombre ‘daemons.ini’. Después de todas estas preguntas, debería verse similar a esto:
0[feeds]1feed = https://daemons.cf/rss.xml2user = drymer@quitter.se3password = contraseñaFalsa4shorten =5fallback_feed =6format = {title} - {link} by @{author}7insecure =
Se pueden crear todos los archivos de configuración que se quieran. Al haber creado el archivo anterior, se han metido en la base de datos todos los feeds que habian hasta el momento. Por lo tanto, cuando se ejecuta gnusrss por primera vez, no posteará nada en GNU Social, a menos que el feed tenga nueva información. Para postear los feeds de un archivo o todos, ejecutar, respectivamente, lo siguiente:
0$ gnusrss.py -p daemons.ini1$ gnusrss.py -P
Si el archivo de configuración ha sido creado manualmente y no se quiere postear el contenido del feed, sólo hay que ejecutar la opción –populate-database para guardar estos en la base de datos:
0 $ gnusrss.py -k otherFile.ini
1.2.7 Crontab
El modo recomendado de ejecución de gnusrss es usando el crontab. Cada vez que se ejecute posteará un sólo elemento del feed para evitar el flood. Según la cantidad de feeds que se publiquen, se deberia escoger un tiempo de ejecución distinto. Para un blog que publique una vez al día, con poner lo siguiente, deberia valer:
0$ crontab -e1# Se abrirá un archivo y se mete lo siguiente2* 12 * * * cd $rutaDEgnusrss && gnusrss.py -p daemons.cf
Así se ejecuta una vez al día, a las doce de la mañana. Si, en cambio, lo usasemos con twitter2rss, se recomienda poner que se ejecute cada cinco minutos. Hay que recordar que es importante que se ejecute en el directorio en el que se ha creado la base de datos, ya que es ahí dónde la buscará.
1.2.9 Bugs
1.2.10 Licencia
0This program is free software: you can redistribute it and/or modify1it under the terms of the GNU General Public License as published by2the Free Software Foundation, either version 3 of the License, or3(at your option) any later version.45This program is distributed in the hope that it will be useful,6but WITHOUT ANY WARRANTY; without even the implied warranty of7MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8GNU General Public License for more details.910You should have received a copy of the GNU General Public License11along with this program. If not, see <http://www.gnu.org/licenses/>.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file gnusrss-0.2.3.1.tar.gz.
File metadata
- Download URL: gnusrss-0.2.3.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30c296e30887c1e54697ad3a868a79db1bbb7cb3fba7672612cc34cfef34f23c
|
|
| MD5 |
ffe9d8bf31468c5686a527729e5ff8f8
|
|
| BLAKE2b-256 |
00cb6e2a5184d1d5cc2bf0b36c8e28cf91411d0eca37686829ee7e0b0047fad4
|