-
Notifications
You must be signed in to change notification settings - Fork 767
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
YouTube: Fix missing fields when run from translation-server #3293
Conversation
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.
- I think we can get all this data from page
<meta>
tags. Title is in<meta name="title">
, description is in<meta name="description">
, duration is in<meta itemprop="duration">
, etc. - We should not use any of these fallbacks if we aren't on the server (
Zotero.isServer
), because they won't change as you browse around the site and navigate to other videos in the mobile/desktop SPA.
let jsonLD; | ||
try { | ||
jsonLD = JSON.parse(text(doc, 'script[type="application/ld+json"]')); | ||
} | ||
|
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.
Revert!
@AbeJellinek |
I think it's alright if it's just on the server. Not ideal, but parsing the microformat is way messier, slower (because of the global regex search), and more prone to breakage. |
Thank you! |
Fixes #3290 by adding an extra fallback for Title, runningTime, Date, Duration, and Description fields based on a regex search for the microformat object, which can be found in the HTML regardless if the page's JS is loaded.