{ "translatorID": "649c2836-a94d-4bbe-8e28-6771f283702f", "label": "TVNZ", "creator": "Sopheak Hean", "target": "^https?://tvnz\\.co\\.nz", "minVersion": "1.0", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2014-04-04 10:01:57" } function detectWeb(doc, url) { if (url.indexOf("/search/") !=-1){ return "multiple"; } else if ((url.indexOf("politics-news/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("politics-news/") !=-1) && (url.indexOf("/video") !=-1) || (url.indexOf("business-news/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("national-news/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("breakfast-news/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("breakfast-news/") !=-1) && (url.indexOf("/video") !=-1) || (url.indexOf("world-news/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("all-blacks/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("weather/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("-news/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("-news/") !=-1) && (url.indexOf("/video") !=-1) || (url.indexOf("on/") !=-1) && (url.indexOf("-video") !=-1) || (url.indexOf("up/") !=-1) && (url.indexOf("/video") !=-1)){ return "tvBroadcast"; } else if ((url.indexOf("news/") !=-1) || (url.indexOf("all-blacks/") !=-1) || (url.indexOf("up/")!=-1)){ return "newspaperArticle"; } } function scrape(doc, url){ if (detectWeb(doc, url) == "newspaperArticle") { var newItem = new Zotero.Item('newspaperArticle'); newItem.url = url; newItem.publicationTitle = "TVNZ"; newItem.language = "en"; newItem.title = ZU.xpathText(doc, '//h1'); var date = ZU.xpathText(doc, '//p[@class="time"]'); if(date){ newItem.date = ZU.trimInternal(date.replace(/\W\bPublished:\W\d{1,2}:\d{1,2}(AM|PM) (\w)+ /g, '')); } //get Author from the article var author = ZU.xpathText(doc, '//p[@class="source"]'); if (author){ newItem.creators.push(ZU.cleanAuthor(author.replace(/\W\bSource:\W+/g, '').replace(/\W+/g, '-'), "author")); } //get Section of the article var section = ZU.xpathText(doc, '//li[@class="selectedLi"]/a/span'); if (section){ section = section.replace(/^s/g, ''); var sectionArray = new Array("Rugby", "All Blacks", "Cricket", "League", "Football", "Netball", "Basketball", "Tennis", "Motor", "Golf", "Other", "Tipping"); //loop through the Array and check for condition for section category //var count =0; for (var i=0; i