Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fanpage.it #3241

wants to merge 1 commit into from

Conversation

EruditeLying
Copy link

Translator for Italian newspaper Fanpage.it. Supports articles and search pages

Translator for Italian newspaper Fanpage.it. Supports articles and search pages

function detectWeb(doc, url) {
if (getSearchResults(doc, true)) return 'multiple'
return 'newspaperArticle';
Copy link
Member

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!

Comment on lines +79 to +80
let section = doc.querySelector('meta[property="og:site_name"]')?.content;
let date = doc.querySelector('time.fp_info__date-updated')?.dateTime;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let linkedData = document.querySelector('script[type="application/ld+json"]')?.textContent;
let linkedData = text('script[type="application/ld+json"]');

Comment on lines +95 to +96
if (section) item.section = ZU.trim(section);
if (date) item.date = ZU.trim(date);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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),
Copy link
Member

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.

@AbeJellinek
Copy link
Member

Sorry, didn't actually submit my review comments here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants