ConsultancyProject1_Auslast.../scraper
Giò b3f12bb04e README anpassen. 2024-07-06 19:35:32 +02:00
..
app Set Cookie for currency to CHF. 2024-07-05 16:46:38 +02:00
bootstrap Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
config refactor. 2024-07-01 20:55:25 +02:00
database Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
public refactor. 2024-07-01 20:55:25 +02:00
resources Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
routes Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
storage raw prototype. 2024-03-23 10:05:14 +01:00
tests Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
.editorconfig raw prototype. 2024-03-23 10:05:14 +01:00
.env.example refactor. 2024-07-01 20:55:25 +02:00
.gitattributes raw prototype. 2024-03-23 10:05:14 +01:00
.gitignore raw prototype. 2024-03-23 10:05:14 +01:00
README.md README anpassen. 2024-07-06 19:35:32 +02:00
artisan Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
composer.json refactor. 2024-07-01 20:55:25 +02:00
composer.lock refactor. 2024-07-01 20:55:25 +02:00
package.json Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
phpunit.xml Downgrade to Laravel 10 2024-05-07 21:31:03 +02:00
vite.config.js raw prototype. 2024-03-23 10:05:14 +01:00

README.md

Web Scraper e-domizil.ch

Das Repository enthält eine auf Laravel (Version 10.x) basierender Web Scraper für die Plattform e-domizil.ch.

Installation

Vorbedingungen für die erfolgreiche Installation sind Server Requirements

  1. Das Repository klonen git clone https://gitea.fhgr.ch/dianigionath/ConsultancyProject1_Auslastungsmodellierung.git
  2. Die Applikation mittels Composer installieren php composer install
  3. Eine Kopie der Datei .env.example nach .env erstellen und den Dateiinhalt bez. Datenbankverbindung anpassen.
cp .env.example .env`
DB_CONNECTION=sqlite
DB_DATABASE=/absolute/path/to/database.sqlite
  1. Mittels Artisan Console die Datenbank initialisieren
php artisan migrate
WARN  The SQLite database does not exist: /home/gio/database_test.sqlite.  

 ┌ Would you like to create it? ────────────────────────────────┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘

   INFO  Preparing database.  

  Creating migration table ............................................................................................................... 31ms DONE

   INFO  Running migrations.  

  0001_01_01_000000_create_users_table ................................................................................................... 57ms DONE
  0001_01_01_000001_create_cache_table ................................................................................................... 18ms DONE
  2019_12_14_000001_create_personal_access_tokens_table .................................................................................. 36ms DONE
  2024_03_15_142227_create_regions_table ................................................................................................. 10ms DONE
  2024_03_15_142228_create_seeds_table ................................................................................................... 18ms DONE
  2024_03_15_142257_create_properties_table .............................................................................................. 17ms DONE
  2024_03_15_142550_create_extractions_table ............................................................................................. 10ms DONE
  2024_03_15_142625_create_exceptions_table .............................................................................................. 10ms DONE
  2024_03_15_162023_create_jobs_table .................................................................................................... 18ms DONE
  2024_04_08_115153_create_failed_jobs_table ............................................................................................. 32ms DONE

  1. Gewünschte Region(en) mittels Artisan Konsole hinzufügen.
php artisan scraper:add-region

 Type in desired region:
 > Davos 

 Choose desired region:
  [5460aea91d044] Davos
  [5390628eeaa24] Davos Davos Platz
  [5460adf3d7913] Davos Clavadel
  [565847a969c59] Prättigau/Davos
  [5460adf87857d] Davos Wolfgang
  [5460adf8f3e46] Davos Monstein
 > Davos

New Region created {"name":"Davos","updated_at":"2024-07-06T17:24:09.000000Z","created_at":"2024-07-06T17:24:09.000000Z","id":1}
New Seed added {"uri":"https:\/\/www.e-domizil.ch\/search\/5460aea91d044?_format=json","region_id":1,"updated_at":"2024-07-06T17:24:09.000000Z","created_at":"2024-07-06T17:24:09.000000Z","id":1}

  1. Zum Schluss sind Cronjobs einzurichten, welche den Webscraper regelmässig ausführt Alle drei Tage um 02:00 die Scraping Jobs erstellen:
0 2 */3 * * /usr/local/bin/php ConsultancyProject1_Auslastungsmodellierung/artisan scrape:jobs

Jeden Tag alle drei Stunden zwischen 04:00 bis 23:00 mit einer zufälligen Verzögerung bis zu einer Stunde den Queue Worker für das Abarbeiten von 250 Jobs ausführen.

0 4,7,9,11,13,15,17,19,21,23 * * * sleep $((RANDOM \% 60))m ; /absolute/path/to/bin/php /absolute/path/to/artisan queue:work --max-jobs=250 --stop-when-empty --max-time=7200