README.rst 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. - `Twitter2RSS <#twitter2rss>`__
  2. - `English <#english>`__
  3. - `About <#about>`__
  4. - `DISCLAIMER <#disclaimer>`__
  5. - `Requirements <#requirements>`__
  6. - `Git repository <#git-repository>`__
  7. - `Installation <#installation>`__
  8. - `Settings <#settings>`__
  9. - `Web Interface <#web-interface>`__
  10. - `Crontab <#crontab>`__
  11. - `License <#license>`__
  12. - `Castellano <#castellano>`__
  13. - `Acerca de <#acerca-de>`__
  14. - `DISCLAIMER <#disclaimer>`__
  15. - `Requisitos <#requisitos>`__
  16. - `Repositorio git <#repositorio-git>`__
  17. - `Instalación <#instalación>`__
  18. - `Configuración <#configuración>`__
  19. - `Interfaz Web <#interfaz-web>`__
  20. - `Crontab <#crontab>`__
  21. - `Licencia <#licencia>`__
  22. Twitter2RSS
  23. ===========
  24. English
  25. -------
  26. About
  27. ~~~~~
  28. twitter2rss searches for twitter's user data and creates a feed from it.
  29. DISCLAIMER
  30. ~~~~~~~~~~
  31. This program searches the data directly on the twitter's website using a
  32. technique called scrapping, it does not use it's API. This means that
  33. any changes made to the website can bug this program. Each time it
  34. happens, will be fixed, but it probably will not work for a while.
  35. Requirements
  36. ~~~~~~~~~~~~
  37. You need a version of Python and pip equal to or greater than 3.4 and
  38. two libraries:
  39. - `requests <https://pypi.python.org/pypi/requests>`__ >= 2.9.0
  40. - `PyRSS2Gen <https://pypi.python.org/pypi/PyRSS2Gen>`__ >= 1.1
  41. It can be used with Python 3.2 (the version that comes with Debian
  42. Wheezy), but you have to change a line.
  43. ::
  44. # Line 30 is:
  45. HTMLParser .__ init __ (self, convert_charrefs = True)
  46. # Change to:
  47. HTMLParser .__ init __ (self)
  48. Git repository
  49. ~~~~~~~~~~~~~~
  50. It's in two places:
  51. - http://daemons.cf/cgit/twitter2rss: the original repository
  52. - https://notabug.org/drymer/twitter2rss/: A mirror in which you can
  53. put your problems and suggestions for improvements
  54. Installation
  55. ~~~~~~~~~~~~
  56. As any program written in Python, is it advisable to use a virtual
  57. environment (virtualenv), but that is user's choice. It can choosen from
  58. the following installation methods:
  59. Installed using pip:
  60. ::
  61. $ su -c "pip3 install twitter2rss"
  62. Using git:
  63. ::
  64. $ git clone git: //daemons.cf/twitter2rss
  65. # Or ...
  66. $ git clone https://notabug.org/drymer/twitter2rss
  67. $ cd twitter2rss
  68. $ su -c "pip3 install -r requirements.txt"
  69. $ su -c "python3 setup.py install"
  70. Settings
  71. ~~~~~~~~
  72. This program has no options, so it should be easy to use. All it have to
  73. be done is to create a file in the directory where ``twitter2rss`` run
  74. and fill it with twitter user's names:
  75. ::
  76. $ cd PATH/TO/twitter2rss/
  77. # Edit user file. The following are just four examples
  78. $ echo -e "snowden\nioerror\neldiarioes\nlamarea_com" > twitter_users
  79. $ twitter2rss.py
  80. # Or if you just want to add or update one
  81. $ twitter2rss.py snowden
  82. In addition, it's possible change the threads used by the program. If
  83. they're increased and the machine is powerful enough, it will run
  84. faster.
  85. By default it uses two threads in the implementation of the program. You
  86. can climb more, if the machine supports it, to five threads. From ten
  87. threads, the speed increase is no longer noticed, so is not worth it.
  88. Web Interface
  89. ~~~~~~~~~~~~~
  90. This repository can be cloned directly into the root of the web server
  91. and run as is with the standard configuration of PHP. For the nginx
  92. virtual host, you can use the file called ``nginx_virtualhost`` file.
  93. This interface does two things: put the Twitter user in the file
  94. ``twitter_users`` and run a Python function in which only creates the
  95. feed of that user.
  96. Crontab
  97. ~~~~~~~
  98. The ``twitter2rss`` preferred execution mode is using crontab. If added
  99. the following, should apply:
  100. ::
  101. $ crontab -e
  102. # A file is open and gets the following
  103. */5 * * * * cd /var/www/twitter2rss && twitter2rss.py
  104. Like this, it runs every five minutes. Is recommended this low execution
  105. time as tweets could be lost otherwise. It has to be remembered that
  106. it's important to run it in the directory where the file
  107. ``twitter_users`` was created, since it's there where it will try to
  108. find it.
  109. License
  110. ~~~~~~~
  111. ::
  112. This program is free software: you can redistribute it and / or modify
  113. it under the terms of the GNU General Public License as published by
  114. the Free Software Foundation, Either version 3 of the License, or
  115. (At your option) any later version.
  116. This program is distributed in the hope That it will be useful,
  117. but WITHOUT ANY WARRANTY; without even the implied warranty of
  118. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  119. GNU General Public License for more details.
  120. You should have received a copy of the GNU General Public License
  121. With This program along. If not, see <http://www.gnu.org/licenses/>.
  122. Castellano
  123. ----------
  124. Acerca de
  125. ~~~~~~~~~
  126. twitter2rss busca los datos de usuarios de twitter y crea un feed a
  127. partir de ello.
  128. DISCLAIMER
  129. ~~~~~~~~~~
  130. Este programa busca los datos directamente en la web de Twitter mediante
  131. una técnica llamada scrapping, no usa su API. Esto quiere decir que
  132. cualquier cambio que hagan a la web puede fastidiar el funcionamiento de
  133. este programa. Cada vez que pase, se procurará arreglarlo, pero es
  134. probable que durante un tiempo no funcione.
  135. Requisitos
  136. ~~~~~~~~~~
  137. Necesita una versión de Python y pip igual o superior a la 3.4 y dos
  138. librerias:
  139. - `requests <https://pypi.python.org/pypi/requests>`__ >= 2.9.0
  140. - `PyRSS2Gen <https://pypi.python.org/pypi/PyRSS2Gen>`__ >= 1.1
  141. Se puede usar con Python 3.2 (la versión que trae Debian Wheezy), pero
  142. hay que modificar una línea.
  143. ::
  144. # Linea 30, es:
  145. HTMLParser.__init__(self, convert_charrefs=True)
  146. # Cambiar por:
  147. HTMLParser.__init__(self)
  148. Repositorio git
  149. ~~~~~~~~~~~~~~~
  150. Está en dos sitios:
  151. - http://daemons.cf/cgit/twitter2rss: el repositorio original
  152. - https://notabug.org/drymer/twitter2rss/: un mirror, en el que se
  153. pueden poner los problemas y sugerencias de mejoras
  154. Instalación
  155. ~~~~~~~~~~~
  156. Cómo con cualquier programa escrito en Python, es recomendable usar un
  157. entorno virtual (virtualenv), pero eso queda a elección del usuario. Se
  158. puede escoger entre los siguientes métodos de instalación:
  159. Instalar usando pip:
  160. ::
  161. $ su -c "pip3 install twitter2rss"
  162. Usando git:
  163. ::
  164. $ git clone git://daemons.cf/twitter2rss
  165. # O ...
  166. $ git clone https://notabug.org/drymer/twitter2rss
  167. $ cd twitter2rss
  168. $ su -c "pip3 install -r requirements.txt"
  169. $ su -c "python3 setup.py install"
  170. Configuración
  171. ~~~~~~~~~~~~~
  172. Este programa no tiene ninguna opción, por lo que debería ser sencillo
  173. de usar. Lo único que hay que hacer es crear un archivo en el directorio
  174. en el que se ejecute ``twitter2rss`` y llenarlo con nombres de usuarias
  175. de Twitter:
  176. ::
  177. $ cd RUTA/A/twitter2rss/
  178. # editar fichero de usuarios. Lo siguiente son sólo cuatro ejemplos
  179. $ echo -e "snowden\nioerror\neldiarioes\nlamarea_com" > twitter_users
  180. $ twitter2rss.py
  181. # O si sólo se quiere añadir o actualizar uno
  182. $ twitter2rss.py snowden
  183. Además, se pueden modificar los hilos que usa el programa. Si se
  184. aumentan y la máquina es suficientemente potente, se ejecutará más
  185. rápido.
  186. Por defecto usa dos hilos en la ejecución del programa. Se puede subir a
  187. más, si la máquina lo soporta, a cinco hilos. A partir de los diez hilos
  188. ya no se nota el incremento de velocidad, por lo que no vale la pena.
  189. Interfaz Web
  190. ~~~~~~~~~~~~
  191. Este repositorio se puede clonar directamente en la raiz del servidor
  192. web y funcionará tal cual con la configuración estándar de PHP. Para el
  193. virtual host de nginx, se puede usar el fichero llamado
  194. ``nginx_virtualhost``.
  195. Esta interfaz hace dos cosas, meter la usuaria de Twitter en el archivo
  196. ``twitter_users`` y ejecutar una función de Python en la que sólo crea
  197. el feed de esa usuaria.
  198. Crontab
  199. ~~~~~~~
  200. El modo recomendado de ejecución de ``twitter2rss`` es usando el
  201. crontab. Con poner lo siguiente, deberia valer:
  202. ::
  203. $ crontab -e
  204. # Se abrirá un archivo y se mete lo siguiente
  205. */5 * * * * cd /var/www/twitter2rss && twitter2rss.py
  206. Así se ejecuta cada cinco minutos. Se recomienda este tiempo de
  207. ejecución tan bajo por que se podrian perder tweets de no ser así. Hay
  208. que recordar que es importante que se ejecute en el directorio en el que
  209. se ha creado el archivo ``twitter_users``, ya que es ahí dónde lo
  210. buscará.
  211. Licencia
  212. ~~~~~~~~
  213. ::
  214. This program is free software: you can redistribute it and/or modify
  215. it under the terms of the GNU General Public License as published by
  216. the Free Software Foundation, either version 3 of the License, or
  217. (at your option) any later version.
  218. This program is distributed in the hope that it will be useful,
  219. but WITHOUT ANY WARRANTY; without even the implied warranty of
  220. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  221. GNU General Public License for more details.
  222. You should have received a copy of the GNU General Public License
  223. along with this program. If not, see <http://www.gnu.org/licenses/>.