From 70e99d56cf94c2ac03382373ec4f5b05a8f89f88 Mon Sep 17 00:00:00 2001 From: James Shakespeare Date: Mon, 9 May 2022 17:02:20 +0100 Subject: [PATCH] Feat: update qz.com selectors and tests (#538) * feat: update qz.com selectors and tests * chore: remove out of date fixture --- fixtures/qz.com/1481758330660.html | 16 ---------------- fixtures/qz.com/1582826662145.html | 2 ++ src/extractors/custom/qz.com/index.js | 14 +++++++++----- src/extractors/custom/qz.com/index.test.js | 14 +++++++------- 4 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 fixtures/qz.com/1481758330660.html create mode 100644 fixtures/qz.com/1582826662145.html diff --git a/fixtures/qz.com/1481758330660.html b/fixtures/qz.com/1481758330660.html deleted file mode 100644 index 414b9454..00000000 --- a/fixtures/qz.com/1481758330660.html +++ /dev/null @@ -1,16 +0,0 @@ - Uber is rolling out self-driving cars in San Francisco in open defiance of the California DMV — Quartz
ARRIVING NOW

Uber is launching self-driving cars in San Francisco the same way it does everything—without permission

Obsession
Getting There
Obsession
Getting There

No one would have confused the self-driving cars Uber debuted in Pittsburgh in September for regular vehicles. The roof of each Ford Fusion was laden with cameras, sensors, and antennae, plus a small LiDAR (laser radar) unit that hummed softly as it spun. The cars themselves were either black or white, with “UBER” on the front doors and “ADVANCED TECHNOLOGIES CENTER” underneath. Inconspicuous they were not.

The autonomous Volvo SUVs Uber is debuting in San Francisco today are a different story. The cameras and LiDAR units are far more compact, closer in appearance to a ski rack than a pile of high-tech sensors. The cars are gunmetal gray, with a small Uber logo on the front, light geometric patterning on the rear doors, and the company’s name on the trunk. If you weren’t really paying attention, you could almost mistake one for a regular car.

But while the autonomous Ubers may be relatively innocuous to consumers, they will be much less so to California regulators. Uber is treading a fine line with this latest rollout of self-driving technologies. The company has not obtained one of the autonomous vehicle testing permits required by California’s Department of Motor Vehicles to trial self-driving cars on public roads in the state. It’s an outlier in this respect: As of Dec. 8, California’s DMV had issued permits to 20 companies, including Google, Tesla, GM, Ford, and Honda.

Self-driving cars are governed at the state level in the US. In Pittsburgh, Uber is taking advantage of a regulatory void in Pennsylvania, which has yet to enact autonomous-vehicle legislation.

Uber’s initial fleet in San Francisco will consist of “a small handful of vehicles,” spokeswoman Chelsea Kohler said, declining to be more specific. As in Pittsburgh, the cars will all be monitored by a safety driver and an Uber test engineer. They will be available to users of UberX, the cheapest private ride offered by the platform.

In a post on Uber’s website, Anthony Levandowski, head of the company’s self-driving efforts, explained why it chose to sidestep the DMV. “Before you think, ‘there they go again’ let us take a moment to explain,” he wrote, a wry nod to Uber’s reputation for dodging local laws. “The rules apply to cars that can drive without someone controlling or monitoring them. For us, it’s still early days and our cars are not yet ready to drive without a person monitoring them.”

The California DMV rebuked that logic. The permits exist “to ensure public safety” as self-driving technology is tested, the DMV said in a statement on Dec. 13. Existing regulations also require companies trialling autonomous cars to notify the DMV of any accidents within 10 business days, and to submit an annual report detailing when humans took over during testing or when self-driving technologies were forced to disengage.

“Twenty manufacturers have already obtained permits to test hundreds of cars on California roads,” the DMV noted. “Uber shall do the same.”

home our picks popular latest obsessions search
\ No newline at end of file diff --git a/fixtures/qz.com/1582826662145.html b/fixtures/qz.com/1582826662145.html new file mode 100644 index 00000000..37ab5bbd --- /dev/null +++ b/fixtures/qz.com/1582826662145.html @@ -0,0 +1,2 @@ + +Nigeria's economy has best quarterly growth since recession — Quartz Africa
Skip to navigationSkip to content
AP Photo/Lekan Oyekanmi
Hustling.
SLOW MOVING

Nigeria’s economy is making a comeback—but it’s still not happening fast enough

Yomi Kazeem
By Yomi Kazeem

Africa reporter

Since suffering a recession and full year of negative growth in 2016, Nigeria, Africa’s largest economy has recovered—slowly.

Data from Nigeria’s statistics bureau shows the pace of recovery remains slow despite noting a milestone: gross domestic product (GDP) grew by 2.55%—the highest quarterly growth rate since the 2016 recession. Overall, Nigeria’s economy grew 2.27% in 2019, slightly higher than it did in the preceding year. And, as is often the case, Nigeria’s economic growth was anchored on its oil exports with production levels remaining stable throughout 2019.

But while being its recent best performance, the economic growth rate remains short of the government’s projections.

The government’s Economic Recovery and Growth Plan (EGRP), launched in the aftermath of the recession, was anchored on aggressive growth from 2017 to 2020 in a bid to turn the economic slump around. But the latest data confirms Nigeria’s economy fell short of the EGRP’s projected GDP growth rate of 4.5% in 2019. In fact, most EGRP projections have been off the mark. For instance, Nigeria’s unemployment rate is nearly double the EGRP’s projected 12% target.

While government’s spin will likely focus on the reality of the economy’s best quarterly performance since the recession, a more nuanced view is that the growth is simply not happening as urgently as the country’s challenges and population growth requires. “The challenge from the policy environment is that the economy will continue to be sluggish—this 2.55% [growth rate] is a continuation of that sluggishness,” says Nonso Obikili, a Lagos-based economist.

Looking forward Nigeria is forecasting economic growth of 7%, but most observers will find that estimate over-optimistic. In January the IMF forecast economic growth of 2.5% in 2020 and in 2021. This would be below sub-Saharan Africa’s average growth rate of 3.5% in both years.

The dampening news for Nigeria is that as much policymakers try to encourage the diversification of the economy the country is still heavily reliant of oil export earnings. This means its fragile economic growth can be abruptly reversed if oil prices drop. This outcome is now a very real possibility amid the coronavirus outbreak in China hitting the global economy and pushing oil prices lower than Nigeria’s budgetary benchmark of $57 per barrel.

In its analysis of the outbreak’s potential economic impact on Nigeria, SBM Intel, a Lagos intelligence firm, says Nigeria is “at risk” of another recession given its “over reliance” on oil sector proceeds. “If oil demand continues to fall with no OPEC intervention in the form of production cuts, tightening supply, a country like Nigeria will be negatively impacted by the downward price trend,” it says.

Sign up to the Quartz Africa Weekly Brief here for news and analysis on African business, tech and innovation in your inbox

diff --git a/src/extractors/custom/qz.com/index.js b/src/extractors/custom/qz.com/index.js index db4366d8..50460e92 100644 --- a/src/extractors/custom/qz.com/index.js +++ b/src/extractors/custom/qz.com/index.js @@ -2,7 +2,7 @@ export const QzComExtractor = { domain: 'qz.com', title: { - selectors: ['header.item-header.content-width-responsive'], + selectors: ['article header h1'], }, author: { @@ -10,15 +10,19 @@ export const QzComExtractor = { }, date_published: { - selectors: ['.timestamp'], + selectors: [['time[datetime]', 'datetime']], }, lead_image_url: { - selectors: [['meta[name="og:image"]', 'value']], + selectors: [ + ['meta[name="og:image"]', 'value'], + ['meta[property="og:image"]', 'content'], + ['meta[name="twitter:image"]', 'content'], + ], }, content: { - selectors: [['figure.featured-image', '.item-body'], '.item-body'], + selectors: ['#article-content'], // Is there anything in the content you selected that needs transformed // before it's consumable content? E.g., unusual lazy loaded images @@ -27,6 +31,6 @@ export const QzComExtractor = { // Is there anything that is in the result that shouldn't be? // The clean selectors will remove anything that matches from // the result - clean: ['.article-aside', '.progressive-image-thumbnail'], + clean: [], }, }; diff --git a/src/extractors/custom/qz.com/index.test.js b/src/extractors/custom/qz.com/index.test.js index 9229fcb6..440bdd8a 100644 --- a/src/extractors/custom/qz.com/index.test.js +++ b/src/extractors/custom/qz.com/index.test.js @@ -14,8 +14,8 @@ describe('QzComExtractor', () => { let url; beforeAll(() => { url = - 'http://qz.com/863015/uber-is-rolling-out-self-driving-cars-in-san-francisco-in-open-defiance-of-california-dmv/'; - const html = fs.readFileSync('./fixtures/qz.com/1481758330660.html'); + 'https://qz.com/africa/1807355/nigerias-economy-has-best-quarterly-growth-since-recession/'; + const html = fs.readFileSync('./fixtures/qz.com/1582826662145.html'); result = Mercury.parse(url, { html, fallback: false }); }); @@ -36,7 +36,7 @@ describe('QzComExtractor', () => { // the article. assert.equal( title, - 'Uber is launching self-driving cars in San Francisco the same way it does everything—without permission' + 'Nigeria’s economy is making a comeback—but it’s still not happening fast enough' ); }); @@ -47,7 +47,7 @@ describe('QzComExtractor', () => { // Update these values with the expected values from // the article. - assert.equal(author, 'Alison Griswold'); + assert.equal(author, 'Yomi Kazeem'); }); // qz doesn't appear to pass the date from the server, @@ -59,7 +59,7 @@ describe('QzComExtractor', () => { // Update these values with the expected values from // the article. - assert.equal(date_published, null); + assert.equal(date_published, '2020-02-24T16:26:29.000Z'); }); it('returns the lead_image_url', async () => { @@ -71,7 +71,7 @@ describe('QzComExtractor', () => { // the article. assert.equal( lead_image_url, - 'https://qzprod.files.wordpress.com/2016/12/uber-self-driving-volvo-sf-e1481735810897.jpg?quality=80&strip=all&w=1600' + 'https://cms.qz.com/wp-content/uploads/2017/04/nigerians-at-a-lagos-island-market.jpg?quality=75&strip=all&w=1400' ); }); @@ -95,7 +95,7 @@ describe('QzComExtractor', () => { // the article. assert.equal( first13, - 'One of the Volvo XC90s Uber is debuting in San Francisco. (Uber) No' + 'Since suffering a recession and full year of negative growth in 2016, Nigeria,' ); }); });