README 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. **Table of Contents**
  2. - `gnusrss <#gnusrss>`__
  3. - `English <#english>`__
  4. - `About <#about>`__
  5. - `Features <#features>`__
  6. - `Requirements <#requirements>`__
  7. - `Git repository <#git-repository>`__
  8. - `Install <#install>`__
  9. - `Configuration <#configuration>`__
  10. - `Crontab <#crontab>`__
  11. - `License <#license>`__
  12. - `Castellano <#castellano>`__
  13. - `Acerca de <#acerca-de>`__
  14. - `Features <#features>`__
  15. - `Requisitos <#requisitos>`__
  16. - `Repositorio git <#repositorio-git>`__
  17. - `Instalación <#instalacin>`__
  18. - `Configuración <#configuracin>`__
  19. - `Crontab <#crontab>`__
  20. - `Licencia <#licencia>`__
  21. gnusrss
  22. =======
  23. English
  24. -------
  25. About
  26. ~~~~~
  27. gnusrss parse feeds and post them to GNU Social. The idea of ​​this
  28. program came from `spigot <https://github.com/nathans/spigot>`__, a
  29. program that posts feeds to the social network
  30. `pump.io <https://pump.io>`__ as does gnusrss but better, because it
  31. controls the possible flood. gnusrss does not have this option and it
  32. will be managed with the crontab (for now).
  33. Features
  34. ~~~~~~~~
  35. - Multiple feed and GNU Social accounts support
  36. - sqlite3 is used to store the feeds
  37. - Can fetch RSS files or url indistinctly
  38. - Twitter image upload support when used with
  39. `twitter2rss <http://daemons.cf/cgit/twitter2rss>`__
  40. Requirements
  41. ~~~~~~~~~~~~
  42. Need a version equal to or greater than python 3 and some libraries:
  43. - `feedparser <//pypi.python.org/pypi/feedparser>`__ >= 5.0
  44. - `pycurl <//pypi.python.org/pypi/pycurl/>`__ >= 7.0
  45. Git repository
  46. ~~~~~~~~~~~~~~
  47. It's in two places:
  48. - http://daemons.cf/cgit/gnusrss: the original repository
  49. - https://notabug.org/drymer/gnusrss/: A mirror in which it can be put
  50. issues and feature requests
  51. Install
  52. ~~~~~~~
  53. As with any program that uses python, it should be used a virtual
  54. environment (virtualenv), but that is user selectable. If he or she
  55. decides to not use it:
  56. Install via pip:
  57. ::
  58. $ su -c "pip3 install gnusrss"
  59. Or clone the repository:
  60. ::
  61. $ git clone git://daemons.cf/gnusrss
  62. # OR ...
  63. $ git clone https://notabug.org/drymer/gnusrss/
  64. $ cd gnusrss
  65. $ su -c "pip3 install -r requirements.txt"
  66. $ su -c "python3 setup.py install"
  67. Configuration
  68. ~~~~~~~~~~~~~
  69. The program is (or should be) quite intuitive. Running the following,
  70. should show the basics:
  71. ::
  72. $ gnusrss.py
  73. usage: gnusrss [-h] [-c file_name] [-C] [-p config_file] [-P] [-k file_name]
  74. Post feeds to GNU Social
  75. optional arguments:
  76. -h, --help show this help message and exit
  77. -c file_name, --create-config file_name
  78. creates a config file
  79. -C, --create-db creates the database
  80. -p config_file, --post config_file
  81. posts feeds
  82. -P, --post-all posts all feeds
  83. -k file_name, --populate-database file_name
  84. fetch the RSS and save it in the database
  85. In any case, if not clear, read the following.
  86. For the first use, it must be created the database and the first
  87. configuration file. This can done using the same command, like this:
  88. ::
  89. $ gnusrss.py --create-db --create-config daemons
  90. Then it will ask several questions to create the first configuration
  91. file. It should look like this:
  92. ::
  93. Database created!
  94. Hi! Now we'll create config file!
  95. Please enter the feed's URL: https://daemons.cf/rss.xml
  96. Please enter your username (user@server.com): drymer@quitter.se
  97. Please enter your password: falsePassword
  98. Do you need to shorten the URLs that you 'post? Please take in account
  99. That You should only use it if your node only have 140 characters.
  100. Answer with "yes" or just press enter if you do not want to use it:
  101. Please enter your feed's fallbackurl. If you do not want or have one,
  102. just press enter:
  103. Now we're gona fetch the feed. Please wait ...
  104. Done! The tags are:
  105. tags
  106. title_detail
  107. link
  108. authors
  109. links
  110. author_detail
  111. published_parsed
  112. title
  113. summary
  114. id
  115. author
  116. published
  117. guidislink
  118. summary_detail
  119. The XML has-been parsed. Choose wich format you want:
  120. Please put the tags inside the square brackets
  121. Ex: {title} - {link} by @{author}: {title} - {link} by @{author}
  122. The file is saved under the name 'daemons.ini'. It should look like
  123. this:
  124. ::
  125. [Feeds]
  126. feed = https://daemons.cf/rss.xml
  127. user = drymer@quitter.se
  128. password = falsePassword
  129. shorten =
  130. fallback_feed =
  131. format = {title} - {link} by @ {author}
  132. It can create all the configuration files you want. When creating the
  133. above file, it put into the database all the feeds that had so far.
  134. Thus, when running **gnusrss** for the first time, it will not post
  135. nothing to GNU Social until the feed has new information. To post feeds
  136. from a concrete config file or all execute, respectively, the following:
  137. ::
  138. $ gnusrss.py -p daemons.ini
  139. $ gnusrss.py -P
  140. If the config file is created manually and the user don't want to post
  141. all the feed's content, just use the –populate-database option to save
  142. them to the database:
  143. ::
  144. $ gnusrss.py -k otherFile.ini
  145. Crontab
  146. ~~~~~~~
  147. The recommended way to execute **gnurss** is using the crontab. Each
  148. time it's run, a single item of the feed will be posted to prevent
  149. flood. Depending on the number of feeds that are published, you should
  150. choose a different runtime. For a blog that publishs once a day, it
  151. could be used the following:
  152. ::
  153. * 12 * * * cd $rutaDEgnusrss && gnusrss.py -p daemons.ini
  154. So it runs once, every day at midday. If, however, it's used with
  155. `twitter2rss <http://daemons.cf/cgit/twitter2rss/>`__, it could be
  156. recommended putting it to run every five minutes. It has to be
  157. remembered that is important to run in the directory where the database
  158. was created, because is where it will search it..
  159. License
  160. ~~~~~~~
  161. ::
  162. This program is free software: you can redistribute it and / or modify
  163. it under the terms of the GNU General Public License as published by
  164. the Free Software Foundation, Either version 3 of the License, or
  165. (At your option) any later version.
  166. This program is distributed in the hope That it will be useful,
  167. but WITHOUT ANY WARRANTY; without even the implied warranty of
  168. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  169. GNU General Public License for more details.
  170. You should have received a copy of the GNU General Public License
  171. Along With This Program. If not, see <http://www.gnu.org/licenses/>.
  172. Castellano
  173. ----------
  174. Acerca de
  175. ~~~~~~~~~
  176. gnusrss parsea feeds y los postea en GNU Social. La idea de hacer este
  177. programa surgió de `spigot <https://github.com/nathans/spigot>`__, un
  178. programa que postea feeds en la red social `pump.io <https://pump.io>`__
  179. igual que hace gnusrss pero mejor, ya que controla el posible flood.
  180. gnusrss no tiene esta opción y se controlará con el propio crontab (de
  181. momento).
  182. Features
  183. ~~~~~~~~
  184. - Soporta múltiples feeds y cuentas de GNU Social
  185. - sqlite3 es usado para guardar los feeds
  186. - Puede usar tanto archivos RSS cómo url indistintamente
  187. - Soporta la súbida de imágenes de Twitter cuando es usado en conjunto
  188. con `twitter2rss <http://daemons.cf/cgit/twitter2rss>`__
  189. Requisitos
  190. ~~~~~~~~~~
  191. Necesita una versión de python igual o superior a la 3 y algunas
  192. librerias:
  193. - `feedparser <https://pypi.python.org/pypi/feedparser>`__ >= 5.0
  194. - `pycurl <https://pypi.python.org/pypi/pycurl/>`__ >= 7.0
  195. Repositorio git
  196. ~~~~~~~~~~~~~~~
  197. Está en dos sitios:
  198. - http://daemons.cf/cgit/gnusrss: el repositorio original
  199. - https://notabug.org/drymer/gnusrss/: un mirror, en el que se pueden
  200. poner los problemas y sugerencias de mejoras
  201. Instalación
  202. ~~~~~~~~~~~
  203. Cómo con cualquier programa con python, es recomendable usar un entorno
  204. virtual (virtualenv), pero eso queda a elección del usuario. Si decide
  205. no usarlo:
  206. Instalar usando pip:
  207. ::
  208. $ su -c "pip3 install gnusrss"
  209. Clonar el repositorio:
  210. ::
  211. $ git clone git://daemons.cf/gnusrss
  212. # O ...
  213. $ git clone https://notabug.org/drymer/gnusrss/
  214. $ cd gnusrss
  215. $ su -c "pip3 install -r requirements.txt"
  216. $ su -c "python3 setup.py install"
  217. Configuración
  218. ~~~~~~~~~~~~~
  219. El programa es (o debería ser) bastante intuitivo. Ejecutando lo
  220. siguiente, deberia verse lo básico:
  221. ::
  222. $ gnusrss.py
  223. usage: gnusrss [-h] [-c file_name] [-C] [-p config_file] [-P] [-k file_name]
  224. Post feeds to GNU Social
  225. optional arguments:
  226. -h, --help show this help message and exit
  227. -c file_name, --create-config file_name
  228. creates a config file
  229. -C, --create-db creates the database
  230. -p config_file, --post config_file
  231. posts feeds
  232. -P, --post-all posts all feeds
  233. -k file_name, --populate-database file_name
  234. fetch the RSS and save it in the database
  235. En cualquier caso, si no queda claro, leer lo siguiente.
  236. Para el primer uso, la base de datos y el primer archivo de
  237. configuración deben ser creados. Podemos hacerlo usando la misma orden,
  238. tal que así:
  239. ::
  240. $ gnusrss.py --create-db --create-config daemons
  241. A continuación hará varias preguntas para configurar el primer archivo
  242. de configuración. Debería verse así:
  243. ::
  244. Database created!
  245. Hi! Now we'll create de config file!
  246. Please introduce the feed's url: https://daemons.cf/rss.xml
  247. Please introduce your username (user@server.com): drymer@quitter.se
  248. Please introduce your password: contraseñaFalsa
  249. Do you need to shorten the urls that you post? Please take in account
  250. that you should only use it if your node only has 140 characters.
  251. Answer with "yes" or just press enter if you don't want to use it:
  252. Please introduce your feed's fallbackurl. If you don't want or have one,
  253. just press enter:
  254. Now we're gona fetch the feed. Please wait...
  255. Done! The tags are:
  256. tags
  257. title_detail
  258. link
  259. authors
  260. links
  261. author_detail
  262. published_parsed
  263. title
  264. summary
  265. id
  266. author
  267. published
  268. guidislink
  269. summary_detail
  270. The XML has been parsed. Choose wich format you want:
  271. Please put the tags inside the square brackets
  272. Ex: {title} - {link} by @{author}: {title} - {link} by @{author}
  273. El archivo se guardará con el nombre 'daemons.ini'. Después de todas
  274. estas preguntas, debería verse similar a esto:
  275. ::
  276. [feeds]
  277. feed = https://daemons.cf/rss.xml
  278. user = drymer@quitter.se
  279. password = contraseñaFalsa
  280. shorten =
  281. fallback_feed =
  282. format = {title} - {link} by @{author}
  283. Se pueden crear todos los archivos de configuración que se quieran. Al
  284. haber creado el archivo anterior, se han metido en la base de datos
  285. todos los feeds que habian hasta el momento. Por lo tanto, cuando se
  286. ejecuta **gnusrss** por primera vez, no posteará nada en GNU Social, a
  287. menos que el feed tenga nueva información. Para postear los feeds de un
  288. archivo o todos, ejecutar, respectivamente, lo siguiente:
  289. ::
  290. $ gnusrss.py -p daemons.ini
  291. $ gnusrss.py -P
  292. Si el archivo de configuración ha sido creado manualmente y no se quiere
  293. postear el contenido del feed, sólo hay que ejecutar la opción
  294. –populate-database para guardar estos en la base de datos:
  295. ::
  296. $ gnusrss.py -k otherFile.ini
  297. Crontab
  298. ~~~~~~~
  299. El modo recomendado de ejecución de gnusrss es usando el crontab. Cada
  300. vez que se ejecute posteará un sólo elemento del feed para evitar el
  301. flood. Según la cantidad de feeds que se publiquen, se deberia escoger
  302. un tiempo de ejecución distinto. Para un blog que publique una vez al
  303. día, con poner lo siguiente, deberia valer:
  304. ::
  305. * 12 * * * cd $rutaDEgnusrss && gnusrss.py -p daemons.cf
  306. Así se ejecuta una vez al día, a las doce de la mañana. Si, en cambio,
  307. lo usasemos con `twitter2rss <http://daemons.cf/cgit/twitter2rss/>`__,
  308. se recomienda poner que se ejecute cada cinco minutos. Hay que recordar
  309. que es importante que se ejecute en el directorio en el que se ha creado
  310. la base de datos, ya que es ahí dónde la buscará.
  311. Licencia
  312. ~~~~~~~~
  313. ::
  314. This program is free software: you can redistribute it and/or modify
  315. it under the terms of the GNU General Public License as published by
  316. the Free Software Foundation, either version 3 of the License, or
  317. (at your option) any later version.
  318. This program is distributed in the hope that it will be useful,
  319. but WITHOUT ANY WARRANTY; without even the implied warranty of
  320. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  321. GNU General Public License for more details.
  322. You should have received a copy of the GNU General Public License
  323. along with this program. If not, see <http://www.gnu.org/licenses/>.