From 0cae728a43321c37a058f5a404c3bb3e359e9f23 Mon Sep 17 00:00:00 2001 From: Thomas Rogers Date: Tue, 20 Jun 2023 02:42:09 +0200 Subject: [PATCH] Add missing files --- .../test/the-atlantic-article.html | 1994 +++++++++++++++++ packages/content-handler/src/index.ts | 2 + .../test/the-atlantic-handler.test.ts | 42 + packages/puppeteer-parse/index.js | 2 +- 4 files changed, 2039 insertions(+), 1 deletion(-) create mode 100644 packages/content-fetch/test/the-atlantic-article.html create mode 100644 packages/content-handler/test/the-atlantic-handler.test.ts diff --git a/packages/content-fetch/test/the-atlantic-article.html b/packages/content-fetch/test/the-atlantic-article.html new file mode 100644 index 000000000..4bef2fea8 --- /dev/null +++ b/packages/content-fetch/test/the-atlantic-article.html @@ -0,0 +1,1994 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Meet the New Population-Control Movement - The Atlantic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+
+
+
+
+ Ideas +
+
+
+

+ The Malthusians Are Back +

+
+
+

+ Climate activists who worry that the world has too many + people are joining an ugly tradition. +

+
+ +
+
+
+
+ Red-and-white graphic illustration showing the Earth from space, but the continents are crowded with giant people +
+
+ Illustration by The Atlantic. Source: Getty. +
+
+
+
+
+
+ +
+
+
+ +
+
+ Saved Stories + +
+
+
+ +
+
+
+

+ Scolding regular people for contributing to climate change is out + of fashion. But scolding people for making new people is, + apparently, totally fine. Many + climate activists + say the + worst thing + an individual can do, from an emissions perspective, is have kids. + The climate-advocacy group Project Drawdown lists “family planning and education,” which are intended to lower fertility rates, as leading + solutions to global warming. Naomi Oreskes, a Harvard historian + and celebrated climate researcher, published an + op-ed + in Scientific American this month titled “Eight Billion + People in the World Is a Crisis, Not an Achievement.” +

+ +

+ In recent years, many climate advocates have emphasized human + population itself—as opposed to related factors such as + consumption and technology—as the driving force behind + environmental destruction. This is, at bottom, a very old idea + that can be traced back to the 18th-century cleric Thomas Malthus. + It is also analytically unsound and morally objectionable. Critics + of overpopulation down through the ages have had a nasty habit of + treating people less as individuals with value and agency than as + sentient locusts. +

+

+ Malthus argued against aid to poor Britons on the grounds that + they consumed too many of the nation’s resources. In making his + case, he semi-accurately described a particular kind of poverty + that we still refer to as the “Malthusian trap” today. Agricultural productivity in poor societies is not high + enough to support the population without significant labor input, + so most people work on small subsistence farms to feed themselves + and their families. The inescapably linear growth in the food + supply could never outstrip the exponential growth in human + populations, he argued. +

+

+ But human societies have proved repeatedly that they can escape + the Malthusian trap. Indeed, agricultural productivity has + improved to support a British population seven times larger than + in Malthus’s time and a global population eight times larger. As a + result of these stubborn facts, most Malthusian imitators haven’t + come out and said they’re Malthusians. And instead of focusing on + famine, they have tended to emphasize humanity’s destruction of + nature. +

+

+ The Stanford biologist Paul Ehrlich has been the world’s leading + overpopulation hawk since the publication of his 1968 book, + The Population Bomb. Ehrlich did warn about food + shortages, but as an entomologist and a conservationist, his + primary concern was our influence on the natural world. “The + progressive deterioration of our environment may cause more death + and misery than the food-population gap,” he wrote. +

+

+ In a description of a trip to New Delhi, he was vividly + forthcoming about his distaste for the living, breathing + individuals who make up a population: +

+
+
+

+ People eating, people washing, people sleeping. People + visiting, arguing, and screaming. People thrusting their hands + through the taxi window, begging. People defecating and + urinating. People clinging to buses. People herding animals. + People, people, people, people. +

+
+
+

+ If people, people, people are the primary threat to the natural + world, what is the solution? Uncomfortable as it is to say, + conservationist and eugenicist theories have long been + intertwined. Indeed, in his newly published autobiography, + Life: A Journey Through Science and Politics, Ehrlich credits the early-20th-century thinker William Vogt, + whom he calls “a liberal conservationist,” as inspiration for his + work on population. Here is how Vogt explained his proposal to + offer “sterilization bonuses” to the poor: +

+
+
+

+ Since such a bonus would appeal primarily to the world’s + shiftless, it would probably have a favorable selective + influence. From the point of view of society, it would + certainly be preferable to pay permanently indigent + individuals, many of whom would be physically and + psychologically marginal, $50 or $100 rather than support + their hordes of offspring that, by both genetic and social + inheritance, would tend to perpetuate the fecklessness. +

+
+
+

+ In the beginning of the previous century, there was simply no + contradiction in being a “liberal conservationist” and being a + eugenicist. Vogt was the national director for the Planned + Parenthood Federation of America, which has recently + reckoned + with the eugenicist commitments of its founder, Margaret Sanger. + The Sierra Club, which was + initially led + by a number of avowed eugenicists, commissioned Ehrlich to write + The Population Bomb and for decades operated a + program + focused on ways to reduce fertility and immigration. +

+

+ Now 90 years old, Ehrlich still takes pride in the work he did + turning population growth into a global concern, even though the + mass famine and pestilence that he predicted in the ’60s never + came to pass. +

+

+ “I must admit,” he writes in his autobiography, “that in 2019 I + was pleased to find an article in a history journal that credited + us ‘neo-Malthusians’ with stimulating ‘thinking of the planet as a + whole and anticipating its future.’” +

+

+ And Ehrlich remains a venerated figure. In January of this year, + CBS featured Ehrlich on an episode of 60 Minutes on + species extinction. The climate scientist Michael Mann called the + memoir a “wide-ranging, wondrous, and pleasantly amusing account + of his amazing life—as a scientist, thinker, communicator, + influencer, and champion for a sustainable world.” +

+

+ Intellectual descendants of Ehrlich’s in the environmental + movement continue to sell old Malthusian wine in new bottles. +

+

+ Oreskes draws attention to the same problem that Ehrlich did in + his day: biodiversity loss associated with high-fertility, + low-productivity societies caught in the Malthusian trap. Because + subsistence farms have low yields, and because the farmers tend to + rely on wood and other biomass for energy, they remain a major + driver of deforestation, land-use change, and wildlife + extirpation. +

+

+ In Oreskes’s recent Scientific American + op-ed, she acknowledges that her ideas have a tarnished legacy. + “Population control is a vexing subject,” she writes, “because in + the past it has generally been espoused by rich people (mostly + men) instructing people in poor countries (mostly women) on how to + behave.” Her workaround is to emphasize educational opportunities + as a “reasonable” way to “slow growth.” In an email, Oreskes said + that she does not consider herself a Malthusian and that she + focuses on education “because we know that it can work, and unlike + some other approaches it is good for women, and non-coercive.” +

+

+ The Overpopulation Project (TOP) also highlights education, + arguing + that governments in every country should “make population and + environmental issues and sex education part of the basic + educational curriculum.” Likewise, + Population Connection + (formerly + Zero Population Growth, which Ehrlich co-founded in 1968) develops “K-12 curricula and + secondary education materials for teachers and professors so they + can easily incorporate population studies into their classes.” +

+

+ Access to education—in general, or to sex ed and “population + studies” in particular—is certainly preferable to Vogt’s forced + sterilization. But what about solutions to environmental decline + that emphasize better growth instead of slower growth? Solutions + such as modern energy infrastructure, high-productivity + agriculture, and access to global markets? +

+

+ Proposals of this sort, which Oreskes refers to derisively as + “cornucopianism,” are the alternatives to Malthusianism that have + proved effective across history. Rough contemporaries of Malthus, + such as the + Marquis de Condorcet, + Karl Marx, and Friedrich Engels, argued that improvements in economic productivity would allow + humans to grow enough food to meet rising population levels, and + they were right. Vogt’s pessimism lost out to the ingenuity of, + among others, the Nobel Peace Prize–winning agronomist Norman + Borlaug, as the historian + Charles Mann + recounts in his 2018 book, + The Wizard and the Prophet. Borlaug’s innovations in wheat and maize cultivation + helped stave off the famines Vogt and other eugenicists had + predicted. Ehrlich, infamously, lost a + bet + with the libertarian economist Julian Simon over resource + scarcity. (Simon goes completely unmentioned in Ehrlich’s + autobiography.) And “cornucopianism” can do more than fend off + famine; it can serve conservationist ends. Thanks to innovation + and technological decoupling, an average American today is + more than twice + as wealthy as an average American was the year + The Population Bomb was published, yet + generates + 30 percent fewer carbon emissions and + uses + 50 percent less land for their diet. +

+

+ Like Oreskes, the scientists at TOP and Population Connection + insist that their proposed solutions to the population “problem” + are noncoercive. They just want to nudge people in the direction + of fewer people. Another of TOP’s + priorities + is to “reduce immigration numbers” to developed countries with low + fertility rates. Additional ideas include proposals to lower + government support for third and fourth children and for medical + fertility treatments. +

+

+ But Ehrlich said the same thing. “I’m against government + interference in our lives,” he + told + an interviewer in 1970. How that sentiment squared with Ehrlich’s + demands in The Population Bomb for “compulsory birth + regulation” and “sterilizing all Indian males with three or more + children” remains unclear. And it didn’t stop powerful + institutions from taking his warnings about overpopulation + literally as well as seriously. As Betsy Hartmann + recounted + in her 1987 exposé, + Reproductive Rights and Wrongs, the Population Council, the International Planned Parenthood + Federation, and other organizations funded fertility-reduction + programs that, in tandem with sometimes coercive government + policies, led to millions of sterilizations in China, India, + Mexico, Bolivia, Peru, Indonesia, Bangladesh, and elsewhere. + China’s one-child policy can be + directly traced + to Limits to Growth, the Club of Rome’s famous Malthusian + screed warning of resource shortages and overpopulation. +

+

+ When the problem is defined as too many carbon emissions, the + solutions will be optimized to reduce emissions. When the problem + is defined as too little education and bodily autonomy, solutions + such as schooling and birth control make intuitive sense. When the + problem is defined as too many people, the “solutions” + will surely once again go far beyond the gentle, humane approaches + that the neo-Malthusians emphasize. As The Atlantic’s + Jerusalem Demsas + put it, “Enough with the innuendo: If overpopulation is the hill you + want to die on, then you’ve got to defend the implications.” +

+ +

+ Fortunately, much of civil society has gotten wise to the new, + friendly Malthusianism. Ehrlich’s appearance on + 60 Minutes was met with + widespread + condemnation. Last year the Sierra Club shut down its + long-standing population-control program, + writing, “Contraception and family planning are not climate mitigation + measures.” +

+

+ And these concerns are being raised at a peculiar moment in human + history. The total population of human beings on Earth is expected + to + peak and decline + later this century, not because of war, famine, or disease, but because of + secularly declining fertility. The challenge that nations + including Germany, South Korea, Japan, and even India and China + are dealing with today is + underpopulation, not overpopulation. Migrants, particularly those who are young + and skilled, will be crucial to generating economic growth in + these countries. This makes the neo-Malthusian dismissal of + technology, infrastructure, and growth particularly troubling. + Supporting an aging population will require an economic surplus + that has traditionally been supplied by a favorable ratio of + younger workers in the labor force to retirees. As that ratio + reverses, it is not clear how infrastructure maintenance and + social-services financing will fare. +

+

+ Given that the Malthusian dream—a peak in global population—is + already in sight, one might think that single-minded efforts to + further suppress population growth would wane. But the old + population-control movement is still alive and well today. +

+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/content-handler/src/index.ts b/packages/content-handler/src/index.ts index c8f5d7baf..dcaaa87f3 100644 --- a/packages/content-handler/src/index.ts +++ b/packages/content-handler/src/index.ts @@ -36,6 +36,7 @@ import { TwitterHandler } from './websites/twitter-handler' import { WeixinQqHandler } from './websites/weixin-qq-handler' import { WikipediaHandler } from './websites/wikipedia-handler' import { YoutubeHandler } from './websites/youtube-handler' +import { TheAtlanticHandler } from './websites/the-atlantic-handler' const validateUrlString = (url: string): boolean => { const u = new URL(url) @@ -56,6 +57,7 @@ const validateUrlString = (url: string): boolean => { } const contentHandlers: ContentHandler[] = [ + new TheAtlanticHandler(), new AppleNewsHandler(), new BloombergHandler(), new DerstandardHandler(), diff --git a/packages/content-handler/test/the-atlantic-handler.test.ts b/packages/content-handler/test/the-atlantic-handler.test.ts new file mode 100644 index 000000000..d83d59964 --- /dev/null +++ b/packages/content-handler/test/the-atlantic-handler.test.ts @@ -0,0 +1,42 @@ +import { TheAtlanticHandler } from '../src/websites/the-atlantic-handler' +import fs from 'fs'; +import nock from 'nock' + +describe('Testing the atlantic opening', () => { + const load = (path: string): string => { + return fs.readFileSync(path, 'utf8') + } + + + before(() => { + const html = load('./test/data/the-atlantic-article.html'); + nock('https://theatlantic.com').get('/article/').reply(200, html) + }) + + it('should parse the title of the atlantic article.', async () => { + const response = await new TheAtlanticHandler().preHandle( + 'https://theatlantic.com/article/' + ); + + // We grab the title from the doucment. + expect(response.title).not.toBeFalsy() + }) + + it('should remove the article section, and replace it with a parseable div', async () => { + const response = await new TheAtlanticHandler().preHandle( + 'https://theatlantic.com/article/' + ); + + // We grab the title from the doucment. + expect(response.dom?.querySelector('[data-event-module="article body"]')).toBeEmptyDOMElement() + }); + + it ('should append a new div, and add the article content inside', () => { + const response = await new TheAtlanticHandler().preHandle( + 'https://theatlantic.com/article/' + ); + + // We grab the title from the doucment. + expect(response.dom?.getElementById('prehandled')).not.toBeEmptyDOMElement() + }) +}) diff --git a/packages/puppeteer-parse/index.js b/packages/puppeteer-parse/index.js index 5915e0fb4..06b9f658d 100644 --- a/packages/puppeteer-parse/index.js +++ b/packages/puppeteer-parse/index.js @@ -14,7 +14,7 @@ const signToken = promisify(jwt.sign); const os = require('os'); const { Storage } = require('@google-cloud/storage'); const { parseHTML } = require('linkedom'); -const { preHandleContent, preParseContent } = require('../content-handler/src/index'); +const { preHandleContent, preParseContent } = require("@omnivore/content-handler"); const { Readability } = require("@omnivore/readability"); const puppeteer = require('puppeteer-extra');