@data-fair/processing-web-scraper 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -280,6 +280,15 @@ exports.run = async ({ pluginConfig, processingConfig, processingId, dir, tmpDir
280
280
  break
281
281
  }
282
282
  }
283
+ page.tags = []
284
+ if (processingConfig.tagsSelectors && processingConfig.tagsSelectors.length) {
285
+ for (const tagsSelector of processingConfig.tagsSelectors) {
286
+ $(tagsSelector).each(function (i, elem) {
287
+ const tag = $(this).text().trim()
288
+ if (tag) page.tags.push(tag)
289
+ })
290
+ }
291
+ }
283
292
 
284
293
  $('meta').each(function (i, elem) {
285
294
  const name = $(this).attr('name')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/processing-web-scraper",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A small Web scraper that publishes its data into data-fair datasets.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -67,6 +67,11 @@
67
67
  "description": "Par défaut le sélecteur 'title' est utilisé ce qui correspond au titre de page dans les métadonnées HTML.",
68
68
  "items": {"type": "string"}
69
69
  },
70
+ "tagsSelectors": {
71
+ "type": "array",
72
+ "title": "Sélecteurs d'éléments HTML à utiliser comme étiquettes",
73
+ "items": {"type": "string"}
74
+ },
70
75
  "sitemaps": {
71
76
  "type": "array",
72
77
  "title": "URLs de fichiers sitemap.xml",
@@ -82,7 +87,7 @@
82
87
  "excludeURLPatterns": {
83
88
  "type": "array",
84
89
  "title": "Formats d'URL à exclure de l'exploration",
85
- "description": "Exemple: https://data-fair.github.io/master/en(/*)",
90
+ "description": "Exemple: https://data-fair.github.io/3/en(/*)",
86
91
  "items": {"type": "string"}
87
92
  },
88
93
  "anchors": {