diff --git a/packages/api/src/utils/parser.ts b/packages/api/src/utils/parser.ts index 06fe8a433..eeba50312 100644 --- a/packages/api/src/utils/parser.ts +++ b/packages/api/src/utils/parser.ts @@ -409,8 +409,8 @@ export const parseUrlMetadata = async ( // as a utility method on each one. export const isProbablyNewsletter = (html: string): boolean => { const dom = parseHTML(html).document - const domCopy = parseHTML(dom.documentElement.outerHTML) - const article = new Readability(domCopy.document, { + const domCopy = parseHTML(dom.documentElement.outerHTML).document + const article = new Readability(domCopy, { debug: false, keepTables: true, }).parse() diff --git a/packages/api/test/services/save_email.test.ts b/packages/api/test/services/save_email.test.ts index fb06c4f95..9e7c49f3e 100644 --- a/packages/api/test/services/save_email.test.ts +++ b/packages/api/test/services/save_email.test.ts @@ -8,6 +8,8 @@ import { getPageByParam } from '../../src/elastic/pages' describe('saveEmail', () => { const username = 'fakeUser' + const fakeContent = 'fake content' + after(async () => { await deleteTestUser(username) }) @@ -21,7 +23,7 @@ describe('saveEmail', () => { } await saveEmail(ctx, { - originalContent: 'fake content', + originalContent: `
${fakeContent}`, url: 'https://example.com', title: 'fake title', author: 'fake author', @@ -30,7 +32,7 @@ describe('saveEmail', () => { // This ensures row level security doesnt prevent // resaving the same URL const secondResult = await saveEmail(ctx, { - originalContent: 'fake content', + originalContent: `${fakeContent}`, url: 'https://example.com', title: 'fake title', author: 'fake author', @@ -42,6 +44,6 @@ describe('saveEmail', () => { expect(page?.url).to.equal('https://example.com') expect(page?.title).to.equal('fake title') expect(page?.author).to.equal('fake author') - expect(page?.content).to.contain('fake content') + expect(page?.content).to.contain(fakeContent) }) }) diff --git a/packages/api/test/services/save_newsletter_email.test.ts b/packages/api/test/services/save_newsletter_email.test.ts index 46d09daa6..b655d196e 100644 --- a/packages/api/test/services/save_newsletter_email.test.ts +++ b/packages/api/test/services/save_newsletter_email.test.ts @@ -12,6 +12,7 @@ import { getPageByParam } from '../../src/elastic/pages' describe('saveNewsletterEmail', () => { const username = 'fakeUser' + const fakeContent = 'fake content' let user: User let email: NewsletterEmail @@ -32,13 +33,16 @@ describe('saveNewsletterEmail', () => { }) it('adds the newsletter to the library', async () => { - await saveNewsletterEmail({ - email: email.address, - content: 'fake content', - url: 'https://example.com', - title: 'fake title', - author: 'fake author', - }, ctx) + await saveNewsletterEmail( + { + email: email.address, + content: `${fakeContent}`, + url: 'https://example.com', + title: 'fake title', + author: 'fake author', + }, + ctx + ) setTimeout(async () => { const page = await getPageByParam({ userId: user.id }) @@ -48,7 +52,7 @@ describe('saveNewsletterEmail', () => { expect(page.url).to.equal('https://example.com') expect(page.title).to.equal('fake title') expect(page.author).to.equal('fake author') - expect(page.content).to.contain('fake content') + expect(page.content).to.contain(fakeContent) }) }) @@ -58,13 +62,16 @@ describe('saveNewsletterEmail', () => { color: '#07D2D1', } - await saveNewsletterEmail({ - email: email.address, - content: 'fake content 2', - url: 'https://example.com/2', - title: 'fake title', - author: 'fake author', - }, ctx) + await saveNewsletterEmail( + { + email: email.address, + content: `fake content 2`, + url: 'https://example.com/2', + title: 'fake title', + author: 'fake author', + }, + ctx + ) setTimeout(async () => { const page = await getPageByParam({ userId: user.id }) diff --git a/packages/api/test/utils/data/substack-forwarded-newsletter.html b/packages/api/test/utils/data/substack-forwarded-newsletter.html index ebfa93cee..0f67fd04d 100644 --- a/packages/api/test/utils/data/substack-forwarded-newsletter.html +++ b/packages/api/test/utils/data/substack-forwarded-newsletter.html @@ -1 +1 @@ -
The phrase, ‘eating people’ (吃人 chī rén), is used to criticise companies in China that exploit their employees. It’s originally from Lǔ Xùn’s (鲁迅), A Madman's Diary (狂人日记 kuángrén rìjì), published in 1918:
The times have changed since Lu Xun made that observation more than 100 years ago, but the culture of ‘eating people’ has not, according to social media comments this week, such as this one:
Two of China’s biggest tech companies, Tencent and Bilibili, have recently been accused of ‘eating people’, abusing and exploiting their staff. So that’s what we discuss this week.
Use this link to claim a one-month free trial of the membership to give the full experience a go: 1. CONVERSATIONS WITH CONSUMINGInterview with Zhang YifeiTwo weeks ago a 25-year-old programmer at Tencent, Zhāng Yìfēi 张义飞, became an Internet sensation after standing up to his bosses at the company. He announced in an internal group chat that he was quitting his job, which then went viral on social media. If 20-hour days is what the company wants, he wrote, ‘I’ll resign tomorrow’ 36Kr interviewed Zhang this week (in Chinese). He talks more about the overtime culture at Tencent, and why he dared to take on his company in such a public way - he already had another job lined up. There are some excellent words in his description of life as a working person at Tencent. Useful words
Idioms
2. WORDS OF THE WEEKBilibili eats peopleA man who headed a content moderation department at Chinese video-streaming site Bilibili died last week after suffering a cerebral hemorrhage while working a Chinese New Year holiday shift. The company was heavily criticised (Sohu - in Chinese) of having a toxic work culture. One of the top comments on social media adapted the line from Lu Xun’s A Madman’s Diary. But instead of looking through the pages of history, overworked netizens find the same message hidden in their payslips:
The words shared below are from the Sohu article and also from social media comments. Useful words
Idioms
Colloquial phrases
3. RECOMMENDATIONSBecome a member of the communityAs a member of the community you get access to unique resources to help you master modern Mandarin, learn, use, and understand Chinese language the way people speak it today.
Use this link to claim a one-month free trial of the membership to give the full experience a go. That’s it for this week. I look forward to seeing you in your inbox same time next weekend. Andrew +++ ps - please do share this newsletter on your social channels and with your networks |
The phrase, ‘eating people’ (吃人 chī rén), is used to criticise companies in China that exploit their employees. It’s originally from Lǔ Xùn’s (鲁迅), A Madman's Diary (狂人日记 kuángrén rìjì), published in 1918:
The times have changed since Lu Xun made that observation more than 100 years ago, but the culture of ‘eating people’ has not, according to social media comments this week, such as this one:
Two of China’s biggest tech companies, Tencent and Bilibili, have recently been accused of ‘eating people’, abusing and exploiting their staff. So that’s what we discuss this week.
Use this link to claim a one-month free trial of the membership to give the full experience a go: 1. CONVERSATIONS WITH CONSUMINGInterview with Zhang YifeiTwo weeks ago a 25-year-old programmer at Tencent, Zhāng Yìfēi 张义飞, became an Internet sensation after standing up to his bosses at the company. He announced in an internal group chat that he was quitting his job, which then went viral on social media. If 20-hour days is what the company wants, he wrote, ‘I’ll resign tomorrow’ 36Kr interviewed Zhang this week (in Chinese). He talks more about the overtime culture at Tencent, and why he dared to take on his company in such a public way - he already had another job lined up. There are some excellent words in his description of life as a working person at Tencent. Useful words
Idioms
2. WORDS OF THE WEEKBilibili eats peopleA man who headed a content moderation department at Chinese video-streaming site Bilibili died last week after suffering a cerebral hemorrhage while working a Chinese New Year holiday shift. The company was heavily criticised (Sohu - in Chinese) of having a toxic work culture. One of the top comments on social media adapted the line from Lu Xun’s A Madman’s Diary. But instead of looking through the pages of history, overworked netizens find the same message hidden in their payslips:
The words shared below are from the Sohu article and also from social media comments. Useful words
Idioms
Colloquial phrases
3. RECOMMENDATIONSBecome a member of the communityAs a member of the community you get access to unique resources to help you master modern Mandarin, learn, use, and understand Chinese language the way people speak it today.
Use this link to claim a one-month free trial of the membership to give the full experience a go. That’s it for this week. I look forward to seeing you in your inbox same time next weekend. Andrew +++ ps - please do share this newsletter on your social channels and with your networks |
Thanks so much for subscribing to Slow Chinese 每周漫闻 and welcome aboard! I’m excited to help you improve and practice your Chinese language skills. Here’s a quick way I can help:
I’ll reply with a specific suggestion to help you. Also, to make sure the next issue of the newsletter doesn’t land in your spam folder, add my email address to your contacts. Thanks! Andrew |
Thanks so much for subscribing to Slow Chinese 每周漫闻 and welcome aboard! I’m excited to help you improve and practice your Chinese language skills. Here’s a quick way I can help:
I’ll reply with a specific suggestion to help you. Also, to make sure the next issue of the newsletter doesn’t land in your spam folder, add my email address to your contacts. Thanks! Andrew |
The German Retreat From Nuclear PowerGermany's economic priorities are torn between industrial growth and energy degrowth. As its last nuclear plants are shut down, the choice is between relying on fossil fuels or closing factories.
|
The German Retreat From Nuclear PowerGermany's economic priorities are torn between industrial growth and energy degrowth. As its last nuclear plants are shut down, the choice is between relying on fossil fuels or closing factories.
|