README.rst 14 KB

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