un script nodejs pour enrichir une instance mobilizon à partir d'un flux rss présentant des évènements. ce script détecte les évènements déjà existants dans l'instance mobilizon et ne crée que ceux qui n'y sont pas encore présent.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Tykayn 4faa6ef364 gather links 1 year ago
.idea update with ts-node 1 year ago
mocks add mocks 1 year ago
models test mongoose 1 year ago
output test mongoose 1 year ago
scrapers gather links 1 year ago
sources_examples gather links 1 year ago
.gitignore ignore node modules 2 years ago
LICENCE.md init parsing rss and postgres connection 2 years ago
README.md start scraping page for CCPL 1 year ago
config.ts start scraping page for CCPL 1 year ago
index.ts multi import events in conf 1 year ago
package-lock.json test mongoose 1 year ago
package.json test mongoose 1 year ago
tsconfig.json test mongoose 1 year ago
utils.ts test mongoose 1 year ago
yarn.lock test mongoose 1 year ago

README.md

Event feeder de Mobilizon

Script nodejs permettant de lire un flux RSS présentant des évènements et de les ajouter à une base de données postgresql d'une instance mobilizon.

Veillez à bien configurer les accès postgres dans la config du script.

Actuellement ce script permet d'importer depuis:

  • l'agenda du libre

source: un flux rss de l'agenda du libre, filtré sur les évènements ayant le tag "openstreetmap".

https://www.agendadulibre.org/events.rss?tag=openstreetmap

projet en nodejs, pour le faire fonctionner, installer les node modules avec

npm i

ajouter un cronjob qui exécute régulièrement (une fois par jour)

ts-node index.ts

Example de requête

Les examples sont mis dans le dossier mocks

  • creation
entêtes:
{
	"POST": {
		"scheme": "http",
		"host": "localhost:4000",
		"filename": "/api",
		"remote": {
			"Adresse": "127.0.0.1:4000"
		}
	}
}
{
	"En-têtes de la requête (2,286 Ko)": {
		"headers": [
			{
				"name": "Accept",
				"value": "*/*"
			},
			{
				"name": "Accept-Encoding",
				"value": "gzip, deflate"
			},
			{
				"name": "Accept-Language",
				"value": "fr,en-US;q=0.7,en;q=0.3"
			},
			{
				"name": "authorization",
				"value": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJtb2JpbGl6b24iLCJleHAiOjE2NDE4MDg1ODIsImlhdCI6MTY0MTgwNzY4MiwiaXNzIjoibW9iaWxpem9uIiwianRpIjoiYTk5YzE3OTQtNThjZS00YmFhLWJhMTktMjcwYWJjNzFkMGI4IiwibmJmIjoxNjQxODA3NjgxLCJzdWIiOiJVc2VyOjEiLCJ0eXAiOiJhY2Nlc3MifQ.9w7JaWQo7j-xHrDspWF5HqnlRBw2U0uyUxNfYbSc6NihyRLTrKFZSMAGNnR2lgZYPO8I-SgiK043wSWau1GnNQ"
			},
			{
				"name": "Cache-Control",
				"value": "no-cache"
			},
			{
				"name": "Connection",
				"value": "keep-alive"
			},
			{
				"name": "Content-Length",
				"value": "4454"
			},
			{
				"name": "content-type",
				"value": "application/json"
			},
			{
				"name": "Cookie",
				"value": "Phpstorm-bbc0ac47=545e6b0c-6c8b-4445-b724-49644b98bd77; ph_mqkwGT0JNFqO-zX2t0mW6Tec9yooaVu7xCBlXtHnt5Y_posthog=%7B%22distinct_id%22%3A%2217c3271b31913d-00bfbf13648a128-30634644-4b9600-17c3271b31a468%22%2C%22%24device_id%22%3A%2217c3271b31913d-00bfbf13648a128-30634644-4b9600-17c3271b31a468%22%7D; BetterErrors-has-used-console=true; _session_id=eyJfcmFpbHMiOnsibWVzc2FnZSI6IklqWTNNV0ZrTVRWaVlXSm1PR1UzWkdKalpqTmlPR0k1WmpZd01qRmhObUU1SWc9PSIsImV4cCI6IjIwMjItMTEtMThUMTc6MzY6MjUuNDY0WiIsInB1ciI6ImNvb2tpZS5fc2Vzc2lvbl9pZCJ9fQ%3D%3D--dede57510dc24f4a60db7864eebd7cc14e4b957a; c1ef4f9f9c63250f85741095ba5caaee=m38cfqt2k3ulmdhvbbtk497hde; f8caea90b77b67b82dd50df996d8d229=drm4t2vb5oqa6nlj0odsmsanse; 5ae7feae4c8f8e8d33845d20924ad9ba=itfhk9eumbgthphqrgrs2gpqi2; BetterErrors-2.9.1-CSRF-Token=18e3c443-00f4-4fe1-a9a0-c65a69915fbb; _mastodon_session=K11iR4Tod4FhspHo1Bxe66Ri%2BYqvWb%2F%2BnoO9WXgbpzsmdLMM%2BV6Vso0AjUz96Tu%2BhzK2Wq8KeZxR4VBKUuFNE8v%2FSdfHX9V0cwhxDU7q%2FwDVEJsgQ8xlKiL3W0v9ab%2BPkI7tLZ7SpsJTfxdLG%2BPonKhR9zApU03Q0ep80%2Fxf6F8JUfqFAsIvBMcko2mHaK%2BU9dGcQtYAFCbijSmEegrzmV0hH57w6dKxrGONmGLNTillxvTL%2BVZagOL7xB93s31jCTIGwtp%2FwVl5GN4LO44f79s3X7kVRh74wKOC8poNyvckfMvERCxj48mnn0Vw8fIj2R341fyOmsYKFoNbeGy3Oh0yFvZxQOBKK05z8%2Bi3O%2BbkFYOYPlGGawrSRQM0cOtqq%2FPV4EZxetKDuKZsTv9og%2FvsmEJwafUekbjL2G%2BsEHf4X9js8bquVaOJH2prOWV8kgBsCH7qnggWk9T5pEjVLvRj36AbsSE627iHz8IdRp646SHKz82uO5SMEgUIsMg7dAJ8fhXIHaMvvisNNwGwkEnzNYWLSLnC3Lpxzn0%3D--cmlZi7NsmOxVoFfx--RyGe8OvwX03BezCSH9bs8g%3D%3D"
			},
			{
				"name": "Host",
				"value": "localhost:4000"
			},
			{
				"name": "Origin",
				"value": "http://localhost:4000"
			},
			{
				"name": "Pragma",
				"value": "no-cache"
			},
			{
				"name": "Referer",
				"value": "http://localhost:4000/events/create"
			},
			{
				"name": "Sec-Fetch-Dest",
				"value": "empty"
			},
			{
				"name": "Sec-Fetch-Mode",
				"value": "cors"
			},
			{
				"name": "Sec-Fetch-Site",
				"value": "same-origin"
			},
			{
				"name": "User-Agent",
				"value": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
			}
		]
	}
}


data scraping

Fait avec puppeteer, lancer la commande: node scrapers/ccpl.js


author: tykayn