-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fanpage.it #3241
base: master
Are you sure you want to change the base?
Fanpage.it #3241
Conversation
Translator for Italian newspaper Fanpage.it. Supports articles and search pages
|
||
function detectWeb(doc, url) { | ||
if (getSearchResults(doc, true)) return 'multiple' | ||
return 'newspaperArticle'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check that it is actually an article!
let section = doc.querySelector('meta[property="og:site_name"]')?.content; | ||
let date = doc.querySelector('time.fp_info__date-updated')?.dateTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let section = doc.querySelector('meta[property="og:site_name"]')?.content; | |
let date = doc.querySelector('time.fp_info__date-updated')?.dateTime; | |
let section = attr(doc, 'meta[property="og:site_name"]', 'content'); | |
let date = attr('time.fp_info__date-updated', 'datetime'); |
let date = doc.querySelector('time.fp_info__date-updated')?.dateTime; | ||
let author = text(doc, '.fp_author__name a[data-anact="autore"]'); | ||
|
||
let linkedData = document.querySelector('script[type="application/ld+json"]')?.textContent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let linkedData = document.querySelector('script[type="application/ld+json"]')?.textContent; | |
let linkedData = text('script[type="application/ld+json"]'); |
if (section) item.section = ZU.trim(section); | ||
if (date) item.date = ZU.trim(date); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (section) item.section = ZU.trim(section); | |
if (date) item.date = ZU.trim(date); | |
if (section) item.section = section.trim(); | |
if (date) item.date = date.trim(); |
No need for ZU.trim()
in modern browsers.
if (date) item.date = ZU.trim(date); | ||
if (author) { | ||
item.creators.push({ | ||
lastName: ZU.trim(author), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Often not institutional creators, right? So we can use ZU.cleanAuthor()
and not set fieldMode: 1
.
Sorry, didn't actually submit my review comments here... |
Translator for Italian newspaper Fanpage.it. Supports articles and search pages