You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.6 KiB

  1. ```
  2. __ _ _ _ _
  3. / _| __| | |__ ___ _ __ (_) __| | ___ _ __
  4. | |_ / _` | '_ \ _____/ __| '_ \| |/ _` |/ _ | '__|
  5. | _| (_| | |_) |_____\__ | |_) | | (_| | __| |
  6. |_| \__,_|_.__/ |___| .__/|_|\__,_|\___|_|
  7. |_|
  8. ```
  9. 1. [Introduction](#introduction)
  10. 2. [Installation](#installation)
  11. 3. [Usage](#usage)
  12. * [Configuration File Syntax](#configuration-file-syntax)
  13. * [Efficient Xpath Copying](#efficient-xpath-copying)
  14. # Introduction
  15. The fdb-spider was made to gather data from Websites in an automated way.
  16. The Website to be spidered has to be a list of Links.
  17. Which makes the fdb-spider a web spider for most Plattforms.
  18. The fdb-spider is to be configured in a .yaml file to make things easy.
  19. The output of the fdb-spider is in json format to make it easy to input
  20. the json to other programs.
  21. At its core, the spider outputs tag search based entries
  22. It works together with the fdb-spider-interface.
  23. In Future, the spider will be extended by the model Sauerkraut.
  24. An !open source! Artificial Neural Network.
  25. # Installation
  26. Create a python3 virtualenv on your favourite UNIX Distribution
  27. with the command
  28. ```
  29. git clone https://code.basabuuka.org/alpcentaur/fdb-spider
  30. cd fdb-spider
  31. virtualenv venv
  32. source venv/bin/activate
  33. pip install -r requirements.txt
  34. ```
  35. then install systemwide requirements with your package manager
  36. ```
  37. # apt based unixoids
  38. apt install xvfb
  39. apt install chromium
  40. apt install chromium-webdriver
  41. # pacman based unixoids
  42. pacman -S xorg-server-xvfb
  43. pacman -S chromium
  44. ```
  45. # Usage
  46. ## Configuration File Syntax
  47. The configuration file with working syntax template is
  48. ```
  49. /spiders/config.yaml
  50. ```
  51. Here you can configure new websites to spider, referred to as "databases".
  52. link1 and link2 are the links to be iterated.
  53. The assumption is, that every list of links will have a loopable structure.
  54. If links are javascript links, specify js[domain,link[1,2],iteration-var-list].
  55. Otherwise leave them out, but specify jsdomain as 'None'.
  56. You will find parents and children of the entry list pages.
  57. Here you have to fill in the xpath of the entries to be parsed.
  58. In the entry directive, you have to specify uniform to either TRUE or FALSE.
  59. Set it to TRUE, if all the entry pages have the same template, and you
  60. are able to specify xpath again to get the text or whatever variable you
  61. like to specify.
  62. In the entry_unitrue directive, you can specify new dimensions and
  63. the json will adapt to your wishes.
  64. Under the entry-list directive this feature has to be still implemented.
  65. So use name, link, javascript-link, info, period and sponsor by commenting
  66. in or out.
  67. If javascript-link is set (which means its javascript clickable),
  68. link will be ignored.
  69. Set it to FALSE, if you have diverse pages behind the entries,
  70. and want to generally get the main text of all the different links.
  71. For your information, the library trafilature is used to gather the
  72. text generally for further processing.
  73. ## Efficient Xpath Copying
  74. When copying the Xpath, most modern Webbrowsers are of help.
  75. In Firefox (or Browsers build on it like the TOR Browser) you can use
  76. ```
  77. strl-shift-c
  78. ```
  79. to open the "Inspector" in "Pick an element" mode.
  80. When you click on the desired entry on the page,
  81. it opens the actual code of the clicked element in the html search box.
  82. Now make a right click on the code in the html search box, go on "Copy",
  83. and go on XPath.
  84. Now you have the XPath of the element in your clipboard.
  85. When pasting it into the config, try to replace some slashes with double
  86. slashes. That will make the spider more stable, in case the websites
  87. html/xml gets changed for maintenance or other reasons.