Skip to content
Permalink
Browse files

[Le Monde] Add abonnes subdomain, fix section title (#1521)

This relates to #1520.
  • Loading branch information...
zuphilip authored and adam3smith committed Jan 14, 2018
1 parent c7ce0da commit c7111bae317a876ae3cf4b194c223b8d674e7e46
Showing with 11 additions and 7 deletions.
  1. +11 −7 Le Monde.js
@@ -2,14 +2,14 @@
"translatorID": "6bc635a4-6823-4f95-acaf-b43e8a158144",
"label": "Le Monde",
"creator": "Philipp Zumstein",
"target": "^https?://(www\\.)?lemonde\\.fr/",
"target": "^https?://(www\\.)?(abonnes\\.)?lemonde\\.fr/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2015-06-09 20:21:01"
"lastUpdated": "2018-01-13 11:53:25"
}

/*
@@ -35,14 +35,16 @@
***** END LICENSE BLOCK *****
*/


function detectWeb(doc, url) {
if (url.indexOf('/article/')>-1) {
if (url.includes('/article/')) {
return "newspaperArticle";
} else if (getSearchResults(doc, true)) {
return "multiple";
}
}


function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
@@ -65,7 +67,7 @@ function doWeb(doc, url) {
if (!items) {
return true;
}
var articles = new Array();
var articles = [];
for (var i in items) {
articles.push(i);
}
@@ -106,7 +108,7 @@ function scrape(doc, url) {
item.creators.push( ZU.cleanAuthor(author, "author") );
}

item.section = ZU.xpathText(doc, '//nav[@id="nav"]/ul/li[contains(@class,"actif")]/a/@data-rubrique-title');
item.section = ZU.xpathText(doc, '//nav[@id="navigation-generale"]/ul/li[contains(@class,"alt")]/a/@data-rubrique-title');

item.complete();
});
@@ -115,7 +117,9 @@ function scrape(doc, url) {
trans.itemType = "newspaperArticle";
trans.doWeb(doc, url);
});
}/** BEGIN TEST CASES **/
}

/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
@@ -251,4 +255,4 @@ var testCases = [
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

0 comments on commit c7111ba

Please sign in to comment.
You can’t perform that action at this time.