Trans: Fix for the new blog URLs layout of CHE
This commit is contained in:
parent
b2bcff1dac
commit
93ffca6833
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"translatorID":"1e6d1529-246f-4429-84e2-1f1b180b250d",
|
"translatorID":"1e6d1529-246f-4429-84e2-1f1b180b250d",
|
||||||
"translatorType":4,
|
"label":"The Chronicle of Higher Education",
|
||||||
"label":"The Chronicle of Higher Education",
|
"creator":"Simon Kornblith, Avram Lyon",
|
||||||
"creator":"Simon Kornblith, Avram Lyon",
|
"target":"^http://chronicle\\.com/",
|
||||||
"target":"^http://chronicle\\.com/",
|
"minVersion":"1.0.0b3.r1",
|
||||||
"minVersion":"1.0.0b3.r1",
|
"maxVersion":"",
|
||||||
"maxVersion":"",
|
"priority":100,
|
||||||
"priority":100,
|
"inRepository":"1",
|
||||||
"inRepository":true,
|
"translatorType":4,
|
||||||
"lastUpdated":"2010-05-27 17:30:00"
|
"lastUpdated":"2010-11-22 22:19:41"
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -38,7 +38,7 @@ function detectWeb(doc, url) {
|
||||||
/* The /daily/ and /weekly/ sections are leftover from the previous version
|
/* The /daily/ and /weekly/ sections are leftover from the previous version
|
||||||
of the translator; they don't appear to still be on the Chronicle site, but
|
of the translator; they don't appear to still be on the Chronicle site, but
|
||||||
they might persist in older URLs. */
|
they might persist in older URLs. */
|
||||||
var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost)\/[^/]+\// ;
|
var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost|blogs\/\w+)\/[^/]+\// ;
|
||||||
if(articleRegexp.test(url)) {
|
if(articleRegexp.test(url)) {
|
||||||
var section = url.match(articleRegexp);
|
var section = url.match(articleRegexp);
|
||||||
switch (section[1]) {
|
switch (section[1]) {
|
||||||
|
@ -49,6 +49,8 @@ function detectWeb(doc, url) {
|
||||||
case "blogPost":
|
case "blogPost":
|
||||||
return "blogPost";
|
return "blogPost";
|
||||||
default:
|
default:
|
||||||
|
if (section[1].indexOf("blogs") !== -1)
|
||||||
|
return "blogPost";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,7 +75,7 @@ function doWeb (doc, url) {
|
||||||
var items = {};
|
var items = {};
|
||||||
var aTags = doc.getElementsByTagName("a");
|
var aTags = doc.getElementsByTagName("a");
|
||||||
for(var i=0; i<aTags.length; i++) {
|
for(var i=0; i<aTags.length; i++) {
|
||||||
var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost)\/[^/]+\//;
|
var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost|blogs\/\w+)\/[^/]+\//;
|
||||||
if(articleRegexp.test(aTags[i].href)) {
|
if(articleRegexp.test(aTags[i].href)) {
|
||||||
items[aTags[i].href] = aTags[i].textContent;
|
items[aTags[i].href] = aTags[i].textContent;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +112,7 @@ function doWeb (doc, url) {
|
||||||
if (dateline !== null) {
|
if (dateline !== null) {
|
||||||
item.date = dateline.textContent;
|
item.date = dateline.textContent;
|
||||||
}
|
}
|
||||||
item.title = doc.evaluate('//div[@class="blog-mod"]/h1[@class="title"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent;
|
item.title = doc.evaluate('//div[@class="blog-mod"]//h1[@class="entry-title"]', doc, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent;
|
||||||
|
|
||||||
// We keep the Chronicle as the Website Type, for lack of a better place
|
// We keep the Chronicle as the Website Type, for lack of a better place
|
||||||
item.websiteType = item.publicationTitle;
|
item.websiteType = item.publicationTitle;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user