Merge pull request #4028 from omnivore-app/fix/excerpt

fix: use article's first meaningful (more than 50 characters) paragraph as excerpt if description not found
This commit is contained in:
Hongbo Wu
2024-06-05 13:57:47 +08:00
committed by GitHub
5 changed files with 16 additions and 10 deletions

View File

@ -80,7 +80,7 @@ export class YoutubeHandler extends ContentHandler {
<meta property="og:image" content="${thumbnail}" />
<meta property="og:image:secure_url" content="${thumbnail}" />
<meta property="og:title" content="${escapedTitle}" />
<meta property="og:description" content="" />
<meta property="og:description" content="${escapedTitle}" />
<meta property="og:article:author" content="${authorName}" />
<meta property="og:site_name" content="YouTube" />
<meta property="og:type" content="video" />

View File

@ -3101,13 +3101,18 @@ Readability.prototype = {
this._postProcessContent(articleContent);
// If we haven't found an excerpt in the article's metadata, use the article's
// first paragraph as the excerpt. This is used for displaying a preview of
// first meaningful paragraph (more than 50 characters) as the excerpt. This is used for displaying a preview of
// the article's content.
if (!metadata.excerpt) {
var paragraphs = articleContent.getElementsByTagName("p");
if (paragraphs.length > 0) {
metadata.excerpt = paragraphs[0].textContent.trim();
}
for (const p of paragraphs) {
const text = p.textContent.trim();
if (text.length > 50) {
metadata.excerpt = text;
break;
}
};
}
if (!metadata.siteName) {
// Fallback to hostname

View File

@ -2,8 +2,9 @@
"title": "New corona regs, Kotti cops, electric cars",
"byline": "Andrew Bulkeley",
"dir": null,
"excerpt": "Hello 20\n Percent,",
"excerpt": "We\n agreed to confine my wife to my sons room. She was included in the\n democratic process because shes the one with corona. And now every time she heads out\n for food, to use the restroom or to just change clothes, we go through a complex tetris of\n opening windows, dawning masks and maintaining social distancing. A weird thing in your own\n house. But weve survived lice, moths in the larder and even black mold - Berlin\n things. So well get through this too - so far its been little more\n than a serious cold for her (YMMV). Since were all\n boostered, it will be interesting to see who is also felled by the virus. Im fine for\n now (knocks on wooden floor).",
"siteName": "fakehost",
"publishedDate": "2001-01-13T16:00:00.000Z",
"language": "English",
"readerable": true
}

View File

@ -1,4 +1,4 @@
<div id="readability-page-1" class="page">
<DIV class="page" id="readability-page-1">
<div>
<div>
<h3> and startups bringing in more money than our brains can comprehend.</h3>
@ -34,7 +34,7 @@
<p>Why make it easy when you can make it more complex? Corona regulations are generally passed by the federal government and then have to be passed again at the state level, often with inexplicable local flourishes, before becoming law. This creates a Germany-wide quilt of differing regulations that few understand. This week is no different though Berlin has decided to stretch the introduction over two days. Starting today in Berlin, <strong>people in contact with an infected person no longer have to go into quarantine if theyve received a booster vaccination or belong to the new “fresh” category</strong> - “freshly” vaccinated or recovered. “Fresh” means within the past three months. Quarantine for other contact persons now ends after 10 days, rather than 14, and people can test out (rapid antibody or PCR) after 7 days. Is anyone enforcing this?</p>
<h3> New corona rules Saturday (tomorrow)</h3>
<p><strong>FFP2 masks are now mandatory on public transport,</strong> so keep the surgical masks until the next time politicians change their minds (the only constant in this pandemic). Bars and restaurants are also 2G plus, which means recently recovered or vaccinated PLUS a same-day negative test result or proof of a booster vaccination. This applies to any other indoor events with more than 10 people as well. </p>
<p data-attrs="{&quot;url&quot;:&quot;https://www.20percent.berlin/p/39-new-corona-regs-kotti-cops-electric?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share&amp;token=eyJ1c2VyX2lkIjo3MjU3NzcyMSwicG9zdF9pZCI6NDcxMTExNzcsImlhdCI6MTY0MjE2MzcwNSwiaXNzIjoicHViLTQ1ODkyOCIsInN1YiI6InBvc3QtcmVhY3Rpb24ifQ.dq7RHyYt5F3T-ZdUes3QPkKhh9HQhl2jAzAlAEAuHmY&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}">
<p data-attrs="{&quot;url&quot;:&quot;https://www.20percent.berlin/p/39-new-corona-regs-kotti-cops-electric?utm_source=substack&utm_medium=email&utm_content=share&action=share&token=eyJ1c2VyX2lkIjo3MjU3NzcyMSwicG9zdF9pZCI6NDcxMTExNzcsImlhdCI6MTY0MjE2MzcwNSwiaXNzIjoicHViLTQ1ODkyOCIsInN1YiI6InBvc3QtcmVhY3Rpb24ifQ.dq7RHyYt5F3T-ZdUes3QPkKhh9HQhl2jAzAlAEAuHmY&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}">
<a href="https://email.mg2.substack.com/c/eJxNksty2jAUhp8G7_Do4gteeEETKG4LKSlhQjYeWzpgYVtyJTmOefrKoZ2pRtKMPp2bjn5WWLgoPaadMtabttyOHaQSBtOAtaC93oDOBU9jEsZxTLDH04DjRbjwhMnPGqAtRJNa3YPX9WUjWGGFkpNHEC4SsvCq9LyAIEJlgUPGITmHlGDAhCMKJccFgnvioucCJIMU3kGPSoLXpJW1nZnR5Yys3RyGwSeoA81AWr8E3QjpcOcWTeau5jlTWsliruFi5rWyVjjSmTk0wKwWbEbXvW1zo3oXYkYfTV8aW7B6RqKJt8BF3zr--aa_kClpXbrJuio0OFqw6YX_AatqmM4wfsOMHMdX0tTZVdHt9YXubmzc_hoE-5rc-Drp3h6yaPfIPraH1Ye7M1nbVNyx7eGEttcV2d7YsHP2xevu5mIItjmKH4c9fnqsx6eHzGRyh08iizL55Z3RvWXtsTrR564kgTjvff47ft6MJxuu6WH-xl_A0P3P-ntVJZt91ZDr8rZslqtlv2lPnkgJIgRhHGBCQ0R94qMI8zJAYRwlJUY89s91OdprXM0C1F6I_69hPlOtp1Mz-kNfle7yMnXskzoRuJ61bS-FHXOQRdkAv-vD3mX22d38AhK0kx_PC5viKCA4ojEKA0TvcpgEFGM34thzablyXtJV3Gl1c__xB_Kk7Mk" rel=""><span>Share</span></a>
</p>
<h3> Kotti police station</h3>
@ -76,4 +76,4 @@
</p>
</div>
</div>
</div>
</DIV>

View File

@ -10,7 +10,7 @@
content="https://i.ytimg.com/vi/c3mbELVqAmo/hqdefault.jpg"
/>
<meta property="og:title" content="The Story of Celeste's Development" />
<meta property="og:description" content="" />
<meta property="og:description" content="The Story of Celeste's Development" />
<meta
property="og:article:author"
content="Noclip - Video Game Documentaries"