Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何以更合理的格式刮取网页?_Python_Web Scraping_Beautifulsoup - Fatal编程技术网

Python 如何以更合理的格式刮取网页?

Python 如何以更合理的格式刮取网页?,python,web-scraping,beautifulsoup,Python,Web Scraping,Beautifulsoup,我正试图从这个网站()上用每个项目的标题和描述来获取列出的gear奖。我已经能够抓取两个项目的信息,但这样做的过程似乎只是复制和粘贴信息会更容易 我真的很想知道更符合逻辑的代码编写方法 #The idea is to collect the list of gear of the year from #backpacker.com magazines website. import requests from bs4 import BeautifulSoup from csv import

我正试图从这个网站()上用每个项目的标题和描述来获取列出的gear奖。我已经能够抓取两个项目的信息,但这样做的过程似乎只是复制和粘贴信息会更容易

我真的很想知道更符合逻辑的代码编写方法

#The idea is to collect the list of gear of the year from 
#backpacker.com magazines website. 

import requests
from bs4 import BeautifulSoup
from csv import writer

source = requests.get('https://www.backpacker.com/gear/editors-choice-2018').text

soup = BeautifulSoup(source, 'lxml')

gear = soup.find(class_='m-detail--body')

#First Gear
for h2_tag in soup.find('h2'):
    print(h2_tag.string)

for gear in soup.find_all('p')[12]:
   print(gear.string)

p_tag = soup.find(class_='m-detail--body')

for p_tag in soup.find_all('p')[14]:
   print(p_tag.string) 

for p_tag in soup.find_all('p')[15]:
   print(p_tag.string)


#Second gear

for h2_tag_two in soup.find_all('h2')[1]:
    print(h2_tag_two.string)

for p_tag_second_gear in soup.findAll('p')[19]:
    print(p_tag_second_gear.string)

for p_tag_second_gear in soup.findAll('p')[20]:
    print(p_tag_second_gear.string)

for p_tag_second_gear in soup.findAll('p')[21]:
    print(p_tag_second_gear.string)

我能够获得我想要的所有信息,但必须有一种更简单的方法。

网页上的产品列表散布在不同的HTML标记之间。为了说明这一点,下面的解决方案通过查找产品名称(
h2
)及其相应的描述(
p
)对每个产品进行分组:

输出:

[{'name': 'Gossamer Gear Mariposa 60', 'description': 'This minimalist pack is made for mowing down the miles.\nDestinations Editor Maren Horjus glimpses Mt. Taranaki after three days of rain.\xa0\nPhoto by Louisa Albanese\nLightweight backpacking means movement, fast and constant, and every detail on the Mariposa 60 has one purpose: to keep you covering ground. The simple, cavernous packbag holds all the items you won’t need when you’re on the move (we had space for six days’ worth of gear and food on a hike around Colorado’s Gore Range), but it’s the positioning of exterior pockets that orients this pack toward big-mile days. A stretchy shove-it pocket on the front fits raingear, gaiters, and a hiking umbrella and has a drain hole to purge excess moisture. On the side, another tall, stretchy pocket swallows a tarp or minimalist shelter. “That’s the last thing you want to pack up on a rainy, cold day, anyway,” says our deputy editor.\nAssorted D-rings litter the pack like Christmas ornaments, so “there’s always one where you need it,” says one tester. “You don’t have to stop to stow your gear—you can do it on the move.” Pockets on the optional hipbelt ($45; highly recommended) hold a phone and sunglasses on one side, and a quart-size bag of snacks on the other.\nYou shouldn’t overload a pack this light, but we found the Mariposa did fine with up to 35 pounds aboard—plenty for anyone with an ultralight kit. Credit the removable aluminum stay for the carrying comfort (though careful packing is required to prevent barreling). And when the day is done, slide out the closed-cell foam backpanel and double it over to use as a sit pad. The hipbelt comes in three sizes, but we found it runs bigger than advertised, so consider sizing down. Ding: The toplid is functional, if minimalist, but scores no points for elegance. –Casey Lyons \n$225 ($270 with hipbelt); 2 lbs. 1 oz. with hipbelt (M); S-L'}, {'name': 'Tecnica Forge GTX', 'description': 'Customization comes to hiking boots.\nThe rocks and roots test\nPhoto by Louisa Albanese\nBoot-fit preferences are like fingerprints: No two are the same. And for hikers with finicky feet, finding the perfect boot can be an exercise in frustration. Until now, a custom-fit boot has been a dream (or about a thousand dollars), but that changes with the Forge.\nWhile the Forge looks and feels like a normal leather midweight, its heel, arch, and ankle collar are made from a thermo-moldable synthetic, like many ski boot liners. It makes sense: Tecnica has been manufacturing some of the world’s most widely liked customizable ski boot liners for decades. The Forge works much the same way. When you purchase a pair, the sales staff uses an in-store machine to mold the insoles and upper (the free service takes about 20 minutes). Afterward, the boots feel like they’ve been yours for months, not minutes. “I have bunions, so new boots are always a struggle, but the personalized fit eliminated pressure on my usual problem areas,” says one Colorado-based tester who spent the summer hiking in the Forge.\nBut custom molding is only the start. An EVA midsole and an overlap collar (in lieu of a traditional tongue) boost comfort even more on big-mile days, which one tester appreciated when tackling the 110-mile Tour du Mont Blanc. Another tester vouched for the traction after crossing miles of slick, wet rock in New Zealand. “We had to ford tons of rain-swollen creeks, and the Vibram Megagrip sole gave me confidence for rock-hopping,” he says. Tradeoff: Customization like this costs a little more than your average midweight boot. –Eli Bernstein\n$250 ($270 for synthetic version); 2 lbs. 10 oz. (m’s 9); m’s 7-14.5, w’s 5.5-10.5'}, {'name': 'Helen Knows Best Extreme Weather Lip Balm', 'description': 'Defend your lips with this silky-smooth, cooling formula.\nPhoto by Adele Hammond\nWe took some of the most innovative, high-performance, and, yes, expensive equipment with us to New Zealand, and yet the most coveted piece of gear was smaller than a Snickers and cost less than a deli sandwich. True story: Even our guides wanted to make off with this tube of magic elixir.\nThe all-natural Extreme Weather Lip Balm from Helen Knows Best moisturizes all day with one application. That’s not a typo: A single swipe in the morning carried us through blistering sunshine, torrential rain, and even meals. Better yet? The moisturizing aloe vera-and-shea butter formula never felt sticky on our lips and never gummed up in cold weather. Since it doesn’t use petroleum derivatives, it stays silky-smooth in all conditions. Beeswax and lanolin provide protection from both the sun and wind, and the chemical-free formula means it’s virtually tasteless. \nThe lip balm rejuvenates, too, so when our lips were already cracked and chapped with neglect, we reached for Helen Knows Best. Organic peppermint cools wind burnt lips, while Vitamins C and E tag-team for repair work. As with any lip balm, the main drawback is that it’s easy to lose, but unlike others, now you also have to worry about protecting it from envious trip partners. –Maren Horjus\n$6 per tube; 0.2 oz.'}, {'name': 'Fjällräven Abisko Trekking Tights', 'description': 'Close-fitting performance matches the trail step for step.\nBells Falls in Egmont National Park\nPhoto by Louisa Albanese\nWe’re used to seeing tights in the coffee shop, yoga studio, and grocery store. But out in the backcountry? Not so much. Despite the unmatched comfort—yep, this is a lady talking—leggings simply aren’t durable. They snag, bag out, fall down under a pack, and, worst of all, lack pockets. Fjällräven solved all those problems at once, making a pair of trekking tights so stellar that they even won over the men on our staff.\nThe Abisko Trekking Tights atone for every downfall of every pair of leggings that came before. First, Fjällräven added reinforcements—a mix of polyamide, aramid, elastane, and polyester—on the knees and seat to protect against scrapes in the highest-wear areas. Second, the company used a dense fabric of 82 percent polyamide and 18 percent elastane for the rest of the tights, ensuring that they comfortably hug our contours—even after four days of trekking through rain. Third, Fjällräven made the pants high-waisted, so the thick, yoga-style band hits above a hipbelt, preventing plumber’s crack beneath a pack. And fourth, best of all, they gave us blessed, blessed pockets. A small zippered pocket on the left thigh is great for snacks and lip balm, while the larger, open-flap pocket on the right thigh is perfect for a smartphone. We, the women of BACKPACKER, have never looked back.\nAs for the men? They (reluctantly) tried out the Abisko Trekking Tights in New Zealand, and were equally impressed. (They preferred to size up, however.) The men’s offering is much the same, but with a normal waist, belt loops, button-zipper front closure, a larger crotch gusset, and hand pockets in addition to the leg pouches. After seven straight days in the Abisko, our male editors agreed: Once you go tight, you don’t go back. –M.H.\n$175; 9.3 oz. (w’s S); m’s XS-XXXL, w’s XXS-XXL'}, {'name': 'Big Agnes Insulated AXL Air ', 'description': 'Carry less, sleep more.\nPhoto Courtesy\nThe numbers say it all—3.25 inches thick, 10.6 ounces—and what they add up to is the best comfort-to-weight ratio we’ve ever seen for a standard-size mummy pad. “I need a pad that offers a lot of support, which normally means carting around a mattress that’s at least a pound,” says one side sleeper. “This is the first one I’ve used that feels ultralight and ultraluxe.” Big Agnes does it by using a tighter-than-normal nylon weave that decreases material weight while boosting durability. Designers also ditched nylon-intensive baffle walls in favor of interior fabric ribbons that connect the upper and lower shell and provide uniform, bed-like support. And, of course, less material means better packability: rolled up, the mattress is the size of a soda can.\nPrimaLoft Silver insulation and a heat-reflective liner boost warmth. Big Agnes doesn’t give the pad an R-value, but we were content in any three-season weather we encountered. (One cold-sleeping tester stayed warm while cowboy camping in the Grand Canyon with a low of 30°F.) Bonus: Thicker air chambers on the sides—a half inch taller than the middle—kept us from rolling off. \nWe like the mummy for maximum weight savings, but it tapers to 14 inches wide at the foot, which some testers said felt narrow. Get the same award-worthy performance in the short (66” x 20”) and regular (72” x 20”) rectangular models; the AXL is also available in a slightly heavier 25-inch wide version and a slightly lighter uninsulated model. –William M. Rochfort, Jr. \n$180; 10.6 oz.; 20 x 72 x 3.25 inches\xa0'}, {'name': 'Jetboil JetGauge', 'description': 'Finally, a foolproof way to measure the fuel level in canisters.\nPhoto Courtesy\nWe all have it: A shelf in the garage (or closet, or basement) cluttered with used canisters. They still have some fuel sloshing around, but how much? Is it enough? Unsure, we head to the store to buy a new one, perpetuating the cycle.\nThat’s the problem Jetboil solves with the JetGuage, a palm-size scale that’s compatible with all standard thread-top fuel canisters. One button turns the gadget on and off and cycles through the most common canister sizes—100, 230, and 450 grams—so you can get an accurate measurement of the remaining fuel. Make sure the canister is screwed on straight and that you’re holding the scale level—and that’s it. \nOne tester was glad to have the gauge on a winter Grand Canyon trek. “With temps getting down to the low 30s and evening coming early at the bottom of the canyon, it was nice to be able to make plenty of hot drinks while keeping an eye on our fuel supply,” he says. “When our large canister felt like it was getting low, I checked and it was actually at 40 percent, so I made another round.” \nWhile we probably won’t take the JetGauge on the trail often, it’s great for determining if those lonely, discarded canisters on your shelf have got one last trip in them yet. –E.B.\n$15; 3 oz.\xa0'}, {'name': '25th Anniversary Hall of Fame', 'description': 'We’ve tested thousands of products over the last quarter century. Not surprisingly, we have favorites. Throughout this anniversary year, we’ll be recognizing these perennial standouts with a special Hall of Fame Award. Here are the first two; look for more in upcoming issues.\xa0'}, {'name': 'Lowa Renegade GTX Mid', 'description': 'Classic style meets modern performance.\nLooking down from the Bridge to Nowhere, Whanganui National Park\nPhoto by Louisa Albanese\nOver the last 20 years, the trend toward lighter gear has pushed many hikers into trail runner territory. That’s OK if your load is light and your trips are on easy trails. But when you want support, stability, and durability, you want the Renegade.\nLOWA introduced the now-classic boot in 1997, and though it has undergone a number of evolutions since (it was last updated in 2010), the German-crafted Renegade remains the brand’s best-selling boot. The formula for its success seems simple at first—nubuck leather upper and supportive sole—but that doesn’t tell the whole story. Yes, the Renegade is a big, burly leather boot, built for eating miles and slaying rough terrain, but, dang, is it comfortable. “Sliding it on is like going through a portal into a slipper,” one editor says. “You think it’s going to be stiff and unforgiving, but it’s not.” A plusher-than-usual collar cushions the ankle, a multipiece upper snugs around the foot neatly, and a two-part insole adds a memory foam-like layer beneath the foot. It’s a recipe that makes the Renegade comfortable out of the box—and after a thousand miles.\nThat’s unusual for a boot with such impressive technical chops. The Renegade, with its PU midsole (great for rebound), PU frame (great for stability), and nylon shank (great for protection), shines on uneven surfaces and beneath oversized loads. It never buckled on volcanic scree slopes in New Zealand, and its Gore-Tex membrane kept us totally dry during three rainy days on the Pouakai Crossing. “We forded countless creeks and walked through ankle-deep muck for hours at a time, and I always felt sure-footed,” one editor says. “At the end of the day, others had to wring their socks out, but my feet stayed completely dry.” In style and performance, the Renegade is a classic, to be sure. Good thing protection, support, and comfort are also timeless. –E.B. \n$230; 2 lbs. 7 oz. (m’s 9); m’s 7.5-15, w’s 5.5-11 (plus narrow and wide options)'}, {'name': 'Gregory Baltoro 65 / Deva 60', 'description': 'Carry anything, anywhere.\nThe Baltoro always has room for more.\nPhoto by Louisa Albanese\nYou can tell a lot about a hiker by his or her backpack. See a Baltoro on the trail and one thing’s for sure: The owner of this pack gets out a lot.\nJust over a decade ago, Gregory designers brought comfort and durability to the fore, knowing that hikers who log big miles with big loads will gladly accept a slight weight penalty for top-notch load carry. And so they made a pack with a suspension system that swivels on a pivot, self-adjusting with the hiker’s hips. It worked then—and it works now. “I hauled 50 pounds on treks in New Zealand, the Grand Canyon, and California’s Trinity Alps, and I never got sore hips,” one editor says. “The padded harness and dynamic movement takes the sting out of long days with big loads.”\nOver the years, Gregory added and improved details, winning over more converts with angled water bottle pockets that make it easy to grab a drink on the move; a waterproof hipbelt pocket that fits a smartphone; and a clever hydration sleeve that turns into a daypack. After giving the pack an Editors’ Choice Award in 2008, we had no choice but to up its status to Editors’ Choice Gold in 2015. Sure, the Baltoro was a bit on the heavy side, but it was the Cadillac of packs.\nWell, now it’s less than 5 pounds, so there goes that logic. Gregory shaved ounces off the packbag by switching to a higher-tear strength 210-denier nylon (and doing away with a PU coating). The suspension system is a bit more streamlined, but not different. All said, the Baltoro now rivals your average big-load pack in weight—while still carrying like a Baltoro. If you want to tell the world you’re all about going fast, there are other packs for you (check out the model on page 14). But if you want to send a message that you’re going far, and often, with any load, the Baltoro is still your pick. –Dennis Lewon\n$300; 4 lbs. 13 oz. (m’s M); m’s S-L, w’s XS-M; Baltoro is also available in 75L, 85L, and 95L and Deva in 70L and 80L'}, {'name': 'Garmin VIRB 360', 'description': 'The future of trip videos looks like this.\nCapturing the Whanganui River from all sides\xa0\nPhoto by Louisa Albanese\nBackpacking is all about the immersive experience. That’s why photos and video rarely do the wilderness justice: They only see in one direction. That’s where 360 video is different. Like its name suggests, it records the action—the views, the movement, the sounds—in all directions, effectively transporting the viewer into that scene. There are a handful of 360 cameras out there, but the VIRB 360—with its blend of simplicity, picture quality, and trailproofing—is the best for hikers.\nThe VIRB’s 4K video and image stabilization are worthy of the pros, but its ease of use and quick-release mounts (for changing perspective on the fly) make it amateur-friendly. Its footage is automatically stitched together in 4K, which makes processing and sharing the video simpler than ever. Editing with Garmin’s software is even intuitive enough that newbies had it dialed in no time. We liked overlaying our trip stats, like GPS location, elevation, and speed, onto our videos. And yes, the rig is trail-ready. It’s rugged enough to record footage from inside a pounding waterfall and it survived a canoe capsize, rough packing, and a 4-foot drop onto rocks. \nThe VIRB 360 does have its drawbacks: Though the housing is shock-proof, the convex lenses do scratch in rough falls (buy replacements for $40). And the battery only offers about 60 minutes of shoot time (we brought extras for overnight trips; they’re $35 apiece). But overall, those are minor tradeoffs for the best 360 camera on the market. Watch this footage, and we think you’ll agree: backpacker.com/nz-360. –D.L. \n$800; 5.6 oz. with battery'}, {'name': 'La Sportiva Trango Tower GTX', 'description': 'Mountaineering boots have never been this comfortable.\nCorey Buhay (front) and Casey Lyons ascend the shoulder of Mt. Taranaki.\xa0\nJeremy Beckers\nThe Trango Tower is either the sturdiest hiking boot we’ve ever tried—or the nimblest mountaineering boot. Whatever its classification, it served us well on everything from overhanging ice climbs in Colorado’s East Vail, to a July summit bid up Mt. Shasta, to every long, dusty approach between.\nBuilt on the stiff, boarded Trango last, the Tower has the foundation of a true mountaineering boot, including a sticky Vibram One sole with edging platforms, a Gore-Tex liner, and a heel welt for crampons. It kept our feet stable and fatigue-free when cramponing up 45-degree slopes and rest-stepping across snowy switchbacks. But the rockered sole allows for easy heel-to-toe walking on flats, and the upper is as comfy as a light hiker. La Sportiva uses its 3D Flex tech, which allows for forward and lateral ankle articulation—the latter increases natural foot movement on approaches—while key zones sport a breathable mesh. (It doesn’t come at the expense of durability, however, as the tough, honeycombed nylon is surrounded by a full rand.) “The Towers are as comfortable tromping around looking for climbs as they are actually climbing,” says one editor. “Most stiff boots leave my bony ankles battered and bruised, but the cutouts allowed for both comfort and ease of motion on everything from log crossings to steep uphills under heavy packs to unstable scree in Montana’s Hyalite Canyon.” \nNone of our testers notched a single blister—even while plunge-stepping down loose volcanic rubble on New Zealand’s Mt. Taranaki and hiking 7 miles to basecamp on Shasta. Versatility never felt so good. –M.H.\n$350; 3 lbs. 3 oz. (37); m’s 36-48, w’s 36-43'}, {'name': 'Editors' Choice Green Award\nGUPPYFRIEND Washing Bag', 'description': 'Keep outdoor apparel from polluting the ocean.\nPhoto Courtesy\nThe sad truth about your favorite rainshell? It’s made with plastic. That means that every time you wash it—or your puffy, fleece, or other synthetic—you’re unintentionally flushing microplastics down the drain, where they’ll eventually make their way into our rivers, lakes, and oceans.\nThat stops now with the Guppyfriend, a mesh laundry bag that traps microfibers before they escape with the waste water. Its 50-micron mesh lets water inside to clean your garments while in the washing machine, but is tight enough that no fibers can slip out. The German Textile Research Institute and the Fraunhofer Institute put the Guppyfriend to the test and discovered that, besides trapping microfibers, it also reduces the amount that comes off the garment in a standard wash cycle. That’s great for the environment—and the life of your synthetic. \nThe 20-by-28-inch laundry bag fits up to three garments. When you’re done, scoop the little threads and fibers out of the Guppyfriend and toss them in the trash. There’s not much to it, but if everyone does his or her part, it will add up to a world of good. –E.B.\n$30; 2.3 oz.'}, {'name': 'Editors' Choice Gold Awards\nDarn Tough Hiker Boot Sock Cushion', 'description': 'Your socks should last at least as long as your boots.\nAssistant Photo Editor Louisa Albanese in camp on the Whanganui River\nPhoto by Louisa Albanese\nWe’ve taken socks to the corners of the world and the extremes of heat and cold. We’ve gotten them wet and muddy, dried them in our sleeping bags overnight, and worn them the next day. And the day after. And here’s what we’ve learned: Most socks are good for a year or two. Some make it three. But for five years and hundreds upon hundreds of miles, the Darn Toughs have always returned to our sock drawer to bear witness as lesser socks lose their shape, lose their elasticity, and lose their yarn, leaving behind a sad nylon skeleton.\nOne dedicated editor put the Darn Tough Hiker head-to-head with every other major and minor brand of sock and it won every bout. Most recently? Five days in a row in Colorado’s Eagles Nest Wilderness, no washes, in a lined shoe frequently overtopped by mud and slop. Still, the Darn Tough persisted—and it was four years old by that point.  \nWhy so durable? Credit the construction: Darn Tough’s engineers analyze wear patterns and come up with specific yarn configurations to meet the abuse, varying combinations of merino, nylon, and elastane across the foot. Need more convincing? Darn Tough backs up the durability promise with a lifetime guarantee. Not that we’ll ever need it. –C.L.\n$24; 4.4 oz. (m’s L); m’s M-XL, w’s S-L\xa0'}, {'name': 'Garmin Oregon Series', 'description': 'One GPS unit to rule them all.\nPhoto Courtesy\nGeeks and neophytes, Gen-Xers and Millennials, Apple users and Android users, it doesn’t matter: The Garmin Oregon GPS unit may be the only piece of tech we can all agree on—and hikers have been agreeing on it for a decade now. For plotting a digital course or having a handy navigation backup, there’s simply nothing better. And though the Oregon has evolved over the years, pushing the envelope with each new model (we gave the Oregon 400t an Editors’ Choice Award in 2009 for its touchscreen), its essential DNA remains the same: deliver cutting-edge features in the easiest-to-operate GPS on the market.\nThe current 750t is idiot-proof. Like your smartphone, it has identifiable icons (hike, mountain bike, climb, fish, etc.) displayed like apps on the 1.5-by-2.5-inch color touchscreen. Our tech newbs figured out how to switch between modes, leave a breadcrumb trail, and plan a route quickly, but that doesn’t mean there isn’t enough there to keep tech wonks happy. The 750t comes preloaded with 1:100,000 U.S. topo maps, an Active Weather feature (which provides up-to-date forecasts and animated weather radar with a cell signal), and an improved antenna for better GPS and GLONASS reception. Nice touch: The included battery runs for some 16 hours on one charge, but the Oregon also works with two AA batteries. –M.H.\n$550 (for the 750t); 7 oz.\xa0'}]

使用CSS选择器非常简单。BeautifulSoup4.7+有一个大大改进的CSS选择器引擎。似乎您需要的所有内容都在HTML类
m-detail--body

似乎每个档位都以一个
h2
元素开始,然后是一些描述档位的
p
元素。似乎您关心的
p
元素必须遵循
h2
元素。因此,我们可以忽略在第一个
h2
之前的第一个
p
元素

但现场有一个异常现象。在另一个
h2
元素之前,有一个
h2
元素的内容为
Editors'Choice Green Award
。我们不想要这个。因此,为了进一步缩小我们的模式,我们需要紧跟着
p
元素的
h2
元素

因此,我们可以构造一个选择器
h2:has(+p),h2~p
,它基本上表示我们需要紧跟
p
元素的
h2
元素,以及前面某处有
h2
元素的
p
元素。最后,这些元素都必须在
m-detail--body
类下,因此我们可以将该选择器分组在
:is()
选择器下,并将其放在类:
.m-detail--body:is(h2:has(+p),h2~p)
之后

然后,每次看到
h2
元素时,我们都会在列表中创建一个条目,其中包含名称和描述,然后我们会将后面看到的所有
p
元素附加到我们创建的最后一个条目中。因此,当我们看到一个新的
h2
,我们会创建一个新条目并附加到该条目

:is()

:has()

现在我们有一个列表,其中包含每个档位的
名称
说明

Gossamer Gear Mariposa 60
This minimalist pack is made for mowing down the miles.Lightweight backpacking means movement, fast and constant, and every detail on the Mariposa 60 has one purpose: to keep you covering ground. The simple, cavernous packbag holds all the items you won’t need when you’re on the move (we had space for six days’ worth of gear and food on a hike around Colorado’s Gore Range), but it’s the positioning of exterior pockets that orients this pack toward big-mile days. A stretchy shove-it pocket on the front fits raingear, gaiters, and a hiking umbrella and has a drain hole to purge excess moisture. On the side, another tall, stretchy pocket swallows a tarp or minimalist shelter. “That’s the last thing you want to pack up on a rainy, cold day, anyway,” says our deputy editor.Assorted D-rings litter the pack like Christmas ornaments, so “there’s always one where you need it,” says one tester. “You don’t have to stop to stow your gear—you can do it on the move.” Pockets on the optional hipbelt ($45; highly recommended) hold a phone and sunglasses on one side, and a quart-size bag of snacks on the other.You shouldn’t overload a pack this light, but we found the Mariposa did fine with up to 35 pounds aboard—plenty for anyone with an ultralight kit. Credit the removable aluminum stay for the carrying comfort (though careful packing is required to prevent barreling). And when the day is done, slide out the closed-cell foam backpanel and double it over to use as a sit pad. The hipbelt comes in three sizes, but we found it runs bigger than advertised, so consider sizing down. Ding: The toplid is functional, if minimalist, but scores no points for elegance. –Casey Lyons $225 ($270 with hipbelt); 2 lbs. 1 oz. with hipbelt (M); S-L
----
Tecnica Forge GTX
Customization comes to hiking boots.Boot-fit preferences are like fingerprints: No two are the same. And for hikers with finicky feet, finding the perfect boot can be an exercise in frustration. Until now, a custom-fit boot has been a dream (or about a thousand dollars), but that changes with the Forge.While the Forge looks and feels like a normal leather midweight, its heel, arch, and ankle collar are made from a thermo-moldable synthetic, like many ski boot liners. It makes sense: Tecnica has been manufacturing some of the world’s most widely liked customizable ski boot liners for decades. The Forge works much the same way. When you purchase a pair, the sales staff uses an in-store machine to mold the insoles and upper (the free service takes about 20 minutes). Afterward, the boots feel like they’ve been yours for months, not minutes. “I have bunions, so new boots are always a struggle, but the personalized fit eliminated pressure on my usual problem areas,” says one Colorado-based tester who spent the summer hiking in the Forge.But custom molding is only the start. An EVA midsole and an overlap collar (in lieu of a traditional tongue) boost comfort even more on big-mile days, which one tester appreciated when tackling the 110-mile Tour du Mont Blanc. Another tester vouched for the traction after crossing miles of slick, wet rock in New Zealand. “We had to ford tons of rain-swollen creeks, and the Vibram Megagrip sole gave me confidence for rock-hopping,” he says. Tradeoff: Customization like this costs a little more than your average midweight boot. –Eli Bernstein$250 ($270 for synthetic version); 2 lbs. 10 oz. (m’s 9); m’s 7-14.5, w’s 5.5-10.5
----
etc.
#The idea is to collect the list of gear of the year from 
#backpacker.com magazines website. 

import requests
from bs4 import BeautifulSoup
from csv import writer

source = requests.get('https://www.backpacker.com/gear/editors-choice-2018').text
soup = BeautifulSoup(source, 'lxml')

gear = []
for element in soup.select('.m-detail--body :is(h2:has(+ p), h2 ~ p)'):
    if element.name == 'h2':
        gear.append({'name': element.get_text(), 'description': ''})
    else:
        gear[-1]['description'] += element.get_text()

for g in gear:
    print(g['name'])
    print(g['description'])
    print('----')
Gossamer Gear Mariposa 60
This minimalist pack is made for mowing down the miles.Lightweight backpacking means movement, fast and constant, and every detail on the Mariposa 60 has one purpose: to keep you covering ground. The simple, cavernous packbag holds all the items you won’t need when you’re on the move (we had space for six days’ worth of gear and food on a hike around Colorado’s Gore Range), but it’s the positioning of exterior pockets that orients this pack toward big-mile days. A stretchy shove-it pocket on the front fits raingear, gaiters, and a hiking umbrella and has a drain hole to purge excess moisture. On the side, another tall, stretchy pocket swallows a tarp or minimalist shelter. “That’s the last thing you want to pack up on a rainy, cold day, anyway,” says our deputy editor.Assorted D-rings litter the pack like Christmas ornaments, so “there’s always one where you need it,” says one tester. “You don’t have to stop to stow your gear—you can do it on the move.” Pockets on the optional hipbelt ($45; highly recommended) hold a phone and sunglasses on one side, and a quart-size bag of snacks on the other.You shouldn’t overload a pack this light, but we found the Mariposa did fine with up to 35 pounds aboard—plenty for anyone with an ultralight kit. Credit the removable aluminum stay for the carrying comfort (though careful packing is required to prevent barreling). And when the day is done, slide out the closed-cell foam backpanel and double it over to use as a sit pad. The hipbelt comes in three sizes, but we found it runs bigger than advertised, so consider sizing down. Ding: The toplid is functional, if minimalist, but scores no points for elegance. –Casey Lyons $225 ($270 with hipbelt); 2 lbs. 1 oz. with hipbelt (M); S-L
----
Tecnica Forge GTX
Customization comes to hiking boots.Boot-fit preferences are like fingerprints: No two are the same. And for hikers with finicky feet, finding the perfect boot can be an exercise in frustration. Until now, a custom-fit boot has been a dream (or about a thousand dollars), but that changes with the Forge.While the Forge looks and feels like a normal leather midweight, its heel, arch, and ankle collar are made from a thermo-moldable synthetic, like many ski boot liners. It makes sense: Tecnica has been manufacturing some of the world’s most widely liked customizable ski boot liners for decades. The Forge works much the same way. When you purchase a pair, the sales staff uses an in-store machine to mold the insoles and upper (the free service takes about 20 minutes). Afterward, the boots feel like they’ve been yours for months, not minutes. “I have bunions, so new boots are always a struggle, but the personalized fit eliminated pressure on my usual problem areas,” says one Colorado-based tester who spent the summer hiking in the Forge.But custom molding is only the start. An EVA midsole and an overlap collar (in lieu of a traditional tongue) boost comfort even more on big-mile days, which one tester appreciated when tackling the 110-mile Tour du Mont Blanc. Another tester vouched for the traction after crossing miles of slick, wet rock in New Zealand. “We had to ford tons of rain-swollen creeks, and the Vibram Megagrip sole gave me confidence for rock-hopping,” he says. Tradeoff: Customization like this costs a little more than your average midweight boot. –Eli Bernstein$250 ($270 for synthetic version); 2 lbs. 10 oz. (m’s 9); m’s 7-14.5, w’s 5.5-10.5
----
etc.