New Glock Drum Mag: The Magpul D50 GL9

New Glock Drum Mag: The Magpul D50 GL9

https://ift.tt/3nGpIZh


For those searching for a Glock Drum Mag, and are familiar with the reliability of the D50 and D60 series of drum magazines, new for 2021 is the Magpul D50 GL9. Distinct from the Magpul D50 GL9-PCC, the D50 GL9 prioritizes and reinforces sections particular to Glock-esque Frames.

Read more on the New Glock Drum Mag, the Magpul D50 GL9:


Lightweight but incredibly strong, our PMAG D50 GL9 is a highly reliable, 9x19mm Parabellum, 50-round drum magazine optimized for double-stack 9mm GLOCK handguns.

glock drum mag magpul d50

The PMAG D-50 GL9 boasts many of the proven features of our other 9mm drums, the PMAG D-50 GL9 – PCC and the PMAG D-50 EV9™. Providing 50-round capacity, the unique drum configuration keeps the height of the magazine manageable, allowing for easier storage. For easy loading, it includes a ratcheting loading lever that removes tension from the internal spring.

To keep track of your available firepower, we’ve included a rounds-remaining rear window, a high-visibility follower and a capacity indication roller.

Easily disassembled for cleaning and featuring an innovative bolt hold-open feature, the D-50 GL9 reliably locks the bolt back on empty when used with firearms designed to lock back on GLOCK pattern magazine followers.

It is recommended that you install a new OEM magazine release on Gen 1-3 GLOCK handguns to support the extra weight of the magazine. Gen 4 GLOCK handguns will require an aftermarket metal magazine release. Installation of a new recoil spring assembly to ensure reliable feeding is strongly recommended. Individual variations between firearms may result in an extra power recoil spring being required.Use of the D-50 GL9 in pistol caliber carbines (PCC) is not recommended, because the increased length of the feed tower will be partially unsupported in most pistol caliber magazine wells. This unsupported condition may cause premature wear on the feed tower magazine catch, and (in firearms which deviate from factory magazine well specifications) may result in improper round presentation and failures to feed.

Made in the USA.

pmag d50 GL9 carousel

Features

  • 50-round capacity
  • Next-generation impact and crush-resistant polymer construction
  • Robust stainless internals withstand corrosion and long-term storage while loaded with no loss of function, spring fatigue, or reliability concerns
  • Ratcheting lever for ease of loading
  • Easy disassembly for cleaning and maintenance
  • High-visibility follower and rounds-remaining window
  • Paint Pen Dot Matrix

Compatibility

  • Double-stack 9mm GLOCK Handguns
  • Use of this magazine in PCCs and large-format pistols is strongly discouraged. For a GLOCK-pattern PCC/large-format pistol compatible magazine, see PMAG D-50® GL9® – PCC (MAG1137)
  • Gen 4 GLOCK handguns require an aftermarket metal magazine release to support the increased weight of the magazine
  • It is recommended to install a new OEM magazine release on GEN 1-3 GLOCK handguns to support the increased weight of the magazine
  • Installation of a new recoil spring assembly to ensure reliable feeding is strongly recommended. Individual variations between firearms may result in an extra power recoil spring being required

SPECS

  • Unloaded Weight: 17.1 oz.
  • Height: 8.7″
  • Width: 4.2″
  • Depth: 3.5″

Colors:BLK
Price: $119.95

glock drum mag d50 gl9


MORE FROM MAGPUL

  • For those using magnified optics, Magpul has Offset Iron Sights. Read more here.
  • Magpul released two new stocks to their already diverse lineup in 2020. Read more.
  • Magpul has their own Knives: hard to find, cost a penny, and are really cool.
  • New in 2021:

guns

via Recoil https://ift.tt/2ycx5TA

January 13, 2021 at 03:03PM

[How-To] Zero a Rifle Scope Quickly & Easily

[How-To] Zero a Rifle Scope Quickly & Easily

https://ift.tt/3sqsPIu

There are some basic life skills that everyone should have…how to change a tire, how to sharpen a knife, how to steal the Declaration of Independence. 

Steal Declaration of Independence
Nick Cage knows what’s up.

Sure, you could have someone do it for you — but it’s better to just learn the skill yourself.

The same can be said for zeroing your rifle scope.

It’s quick, it’s easy, and you’ll never need to rely on someone else to do it for you.

PA 1-8x through scope
View through the Primary Arms 1-8x SLx on a bright day.

In this article, we’re going to cover the important aspects of zeroing you need to know.

From basic terminology to the actual steps involved in getting your rifle on target, you’ll get a good grasp on what it takes to zero any scope.

So, read on to learn more…

Table of Contents

Loading…

Basic Terms And Important Info

If you want to learn to zero a scope, I’m going to bet that you’re either a very new shooter or at least very new to optics.

Either way, let’s cover some terms and other basic info that will help you out down the road.

POI vs. POA

Very simple, your point of impact and your point of aim.

They are both exactly what they sound like.

Point of impact (POI) is where your round hits the target.

Point of aim (POA) is where your reticle or sight is on the target.

POI Vs. POA
POI Vs. POA

Turrets

They come in many flavors but they should have some common characteristics. Turrets turn and should be marked with hash marks and maybe numbers.

Each mark should be one “click” and you should be able to feel the turret’s detent literally click as you turn the turret.

Some are more clicky than others though. The cheaper the scope the less likely you’ll get good firm clicks.

Each of those marks and clicks correspond to how much your reticle moves. While it depends on your scope, the most common adjustment increments are 1/4 MOA, 1/2 MOA, and 0.1 MILs. 

Normally on your turret or on the cap for the turret, it will tell you how much your clicks are.

Athlon BTR Gen II (8)
Athlon BTR Gen II, 1 click = 0.1 MIL

MOA vs. MIL

For zeroing your scope it really doesn’t matter if you’re in MILs or MOA.

If you’re counting and trying to math your way to a zero, then you’ll need to know what your scope is calibrated in.

But that’s about it.

Yards vs. Meters

Kind of like MOA and MIL, it’s not critical what unit of measurement you use.

Keep in mind that MOA and MILs are angler measurements. They can BOTH be used with EITHER yards or meters. It just changes the math a bit.

Family Guy Math

Normally — MOA is going to be in yards and this is the most common measurement in general. 

Whatever unit you pick, stick with it. It’s important to keep things consistent so that you don’t have to do conversion after conversion.

Bullets Travel in an Arc! (kind of but not really)

Something you might have been told or might think yourself is that bullets travel in an arc. That’s…not really true. Kind of.

Ballistic arc
Ballistic arc RifleShooter

If you’re aiming level, your bullet will not rise significantly before falling. Gravity is going to do what gravity does and start pulling that bullet down to earth as soon as it leaves the barrel.

A bullet fired level to the ground and a bullet dropped from the same height will hit the ground at the same time.

Where the arc comes from is in how we aim. Because we know gravity is a thing and it’s constant, it’s easy to account for.

gravity stick man physics
Gravity, yo

When you zero a rifle, you’re generally zeroing it so that the barrel is angled up and away from you. While your line of sight remains flat and on target, the barrel is pointed slightly up.

When you fire, the bullet leaves the barrel traveling upward first — then starts to fall thus giving an “arc.”

We can exploit this for our own gain, but more on that later.

What Distance Should I Zero?

Before you hit the range, think about what distance you want to zero your rifle.

The normal standard is generally 100-yards for a centerfire rifle and 25/50-yards for a .22 LR rimfire rifle.

If you’re not sure what to zero your rifle at or want to make it easy, just pick one of those.

600 Yards at Angeles Range, Marked
600-yards at Angeles Range. We still zero at 100!

Honestly, unless you’re trying to be fancy, it doesn’t matter which one you choose.

If you want to go a little deeper though, you might consider the Maximum Point Blank Range method.

Maximum Point Blank Range

Remember six sentences ago when I said we could exploit the arc for our gain? Well, this is how.

Draw a straight line through your ballistic arc and the lines will intersect twice — once closer to you and once further away. This gives you two zero points such as a 25/300, 36/300, etc.

bullet trajectory vs line of sight
Bullet trajectory vs line of sight…not to scale!

MPBR is the range that your rifle can shoot with minimal elevation change. Note, this is not for precision shooting. This is for kill-shot shooting. 

Think of it this way: if a whitetail deer’s heart and lung area is roughly a 7-inch circle, it’s not critically important if you hit the top, bottom, or center of that circle.

Champion Traps and Targets, Deer Target 25x25 (6 Pack)
If you’re getting ready for deer season, targets like this can help too.

With a little ballistic math, you can zero your rifle so that at any distance out to 200-, 300-, or even 400-yards your shot elevation will be within that circle.

When you’re in the field, just account for wind and point and click on the center of your target to fill your freezer.

This is also how military zeros work, normally called Battlesight Zeros. 25/300-meters and 36/300-yards are the US Army and USMC standards for 5.56 NATO and work the same way as an MPBR.

Army
If it’s good enough for the military, it’s good enough for us.

Keep in mind that an MPRB only works if you have good data and use the same ammo consistently.

If you zero with .30-06 M2 ball and then hunt with .30-06 Hornady ELD-X, your zero is going to be wrong.

If you want to dive into the why and how behind it all, take a look at the Best AR-15 Battlesight Zero. But for now, just trust the magic.

magic

I use an MPBR for my home defense rifle off a 25/225-yard zero.

From 0-yards to 250-yards, I’m never more than 3-inches high or low from my point of aim. My rifle has a red dot, so 250-yards is at the upper limit that I would push the rifle.

What About REALLY Long Range?

100-yards for centerfire, 25/50 for rimfire.

Unless you’re shooting ELR at something crazy like 2,000+ yards, just zero at 100-yards.

sighting in rifle
100-yards is an adequate distance to zero.

There is no real advantage at zeroing past 100-yards even for long-range shooting and 100-yards gives you an easy base to go off of.

Unless…you can’t. If you’re using a 20, 30, or more MOA base — you might have a problem.

20, 30, 40 MOA Bases, Rails, and Rings

Okay, we’re starting to get in the weeds here but bear with me.

If your scope rings, base, or rail says it is 20, 30, 40, or really anything more than zero MOA this means it’s machined on an incline to allow for you to use more of your scope’s internal elevation adjustment.

For centerfire 20 MOA is pretty common, for rimfire 20-40 MOA can be found.

You can’t really tell just from looking, but this is a 40 MOA 1913 rail on this Bergara B-14r .22 LR rifle

If your bases/rail/rings don’t mention MOA or say zero MOA, then they are machined normally and you don’t have to worry about this.

Generally, I would recommend that you simply avoid the issue unless you know that you need it. If you’re not sure, then assume you don’t need it.

If you do use one and cannot zero at 100-yards, zero for 200.

How To Zero Your Scope

There are probably two dozen or so different ways of zeroing your scope. None of them are wrong and some of them are easier than others.

All of them are pretty quick and painless though so it really comes down to personal preference.

9 Tested Long Range Scopes
So many scopes…

Having zeroed loads of optics in my time at Pew Pew, I’ve tried many of the methods and have gradually built what I like best.

1. The No-Tech Method

Regardless of where your final zero will land, your first step is to just get your rifle on paper.

“On paper” meaning your point of aim and your point of impact is close enough that you’re at least on the target. 

Daniel Defense DDM4 V7 66-grain ammo target
We’re trying to get shots on the actual target.

It’s always best to zero a scope using a firm rest. Don’t try to do this off-hand or unsupported. Get some bags and shoot off them, use a shooting bench, use a shooting rest, use whatever you want — just do it supported.

PSA .224 Valkyrie At High Bar Homestead
PSA .224 Valkyrie At High Bar Homestead, bipod and rear bag for support

I normally use a front bag or bipod and a rear bag in either a sitting at a bench rest or prone position.

The simple way of doing this is to shoot first at a relatively short range and then work your way back to your zero distance. If I’m going no-tech, I start with 25-yards.

Aim for a bullseye, take a shot, and with the rifle still in a rested and secure position place your crosshair back on the bullseye. Then adjust your turrets until they are over the shot while moving the rifle as little as possible.

Getting On Paper
Not to scale example of shooting at 25-yards.

This takes a firm and steady hand, but once you do it a couple of times it’s super easy. Aim at the bullseye again and take a shot to confirm zero and readjust as needed.

Do it right and you can zero a rifle with just two shots.

Center Shot
Again, not to scale — but you get the idea now

Once you’re on at 25-yards, you can normally move your target back to wherever you want your final zero to be and zero at that range.

Math And Counting

If you find that your hand isn’t steady enough for this method, then switch to a target that has a grid on it.

A target with a grid makes counting inches a LOT easier.

Easy Button
We like easy.

Once you can count how far off your point of impact is from your point of aim, you can just convert that number into clicks and adjust your scope based on that.

For example, let’s say you’re using an MOA scope with .25 MOA click adjustments at 25-yards and your shot was 3-inches low and 2-inches to the left.

Getting On Paper
Using this as our example again, the grid lines make it easy to work out how much and what direction we need to adjust

1-inch at 100-yards is (roughly) 1 MOA. At 25-yards 1 MOA is 1/4-inch. 3-inches at 25-yards would be 12 MOA low. 

12 times 4 is 48 clicks.

Adjust “up” (normally counter-clockwise but check your scope and follow the up arrow) 48 clicks.

For the 2-inches to the left, 8 clicks “right” and you should be pretty on target.

Trigger hand to adjust scope
Making adjustments.

Now personally, I hate this method because…numbers and math and counting and ugh. But hey, if your brain works better with numbers — go for it.

If you want to learn more about MOA or learn about MILs, take a look at the MOA Vs. MRAD article!

2. The Low-Tech Method

If you want to skip needing to paper the gun at a shorter range you might want to look at getting a bore sight.

For me, I have to zero and re-zero a LOT of guns and a LOT of scopes — so I have a Wheeler Pro Bore Sight and it was worth every penny of the $100 I spent. YMMV.

Wheeler Boresight (3)
Wheeler Pro Bore Sight

If you want a cheaper option, there are some decent ones in the $20ish range.

We have a ton more info on that in the Best Laser Bore Sights hands-on testing.

Simply install the bore sight per the instructions, turn it on, and at your zero range adjust your scope so that the dot matches your crosshairs.

Best Bore Sight
107

at Amazon

Prices accurate at time of writing

Prices accurate at time of writing

With this, you should be pretty close to a true zero and most definitely on paper. 

Then just zero your scope like normal and you’re good to go.

So which method do I use?

As you can probably guess, I use a bore sight and the 2-shot zero method. I normally bore sight at home and then final zero at the range. 

I have a back wall that is exactly 55-yards away from my backdoor. It’s easy for me to stand in the dining room with a rifle pointed at a piece of paper I keep in a ziploc on a stick at the base of the wall.

Bushnell Boresight mounted on the .270 Win
A Bushnell Boresight mounted on the .270 Win.

No disturbing the neighbors, no having to bore sight at the range, and I can almost always zero a rifle with literally two shots once I’m at the range.

Once I have my zero I always confirm with a 10-shot group.

Conclusion

Zeroing a rifle is easy to talk about and pretty easy once you do it once or twice, but that first time can be a ride. Maybe you’ll get it in a few shots, maybe you won’t.

If you don’t, it’s okay. If you need to reset and restart, do it.

Squeezing your rear bag to adjust your hight and aim while also giving yourself a solid shooting rest.
Keep at it and you’ll be a zeroing pro in no time!

While none of us like to admit it, most of us screw up zeroing our rifles at one time or another. So take it slow and don’t be too hard on yourself.

What’s your preferred zeroing method? Share your thoughts in the comments below. Meanwhile, check out our guide to the Best Rifle Scopes for All Budgets to find the perfect model for you.

The post [How-To] Zero a Rifle Scope Quickly & Easily appeared first on Pew Pew Tactical.

guns

via Pew Pew Tactical https://ift.tt/2m7cc0U

January 11, 2021 at 05:33PM

These 6 browser extensions will protect your privacy online

These 6 browser extensions will protect your privacy online

https://ift.tt/3sc4LZO

The internet is not a private place. Ads try to learn as much about you to sell your information to the highest bidder. Emails know when you open them and which links you click. And some of the biggest internet snoops, like Facebook and Amazon, follow you from site to site as you browse the web.

But it doesn’t have to be like that. We’ve tried and tested six browser extensions that will immediately improve your privacy online by blocking most of the invisible ads and trackers.

These extensions won’t block every kind of snooping, but they will vastly reduce your exposure to most of the efforts to track your internet activity. You might not care that advertisers collect your data to learn your tastes and interests to serve you targeted ads. But you might care that these ad giants can see which medical conditions you’re looking up and what private purchases you’re making.

By blocking these hidden trackers from loading, websites can’t collect as much information about you. Plus by dropping the unnecessary bulk, some websites will load faster. The tradeoff is that some websites might not load properly or refuse to let you in if you don’t let them track you. You can toggle the extensions on and off as needed, or you could ask yourself if the website was that good to begin with and could you not just find what you were looking for somewhere else?

HTTPS Everywhere

We’re pretty much hardwired to look for that little green lock in our browser to tell us a website was loaded over an HTTPS-encrypted connection. That means the websites you open haven’t been hijacked or modified by an attacker before it loaded and that anything you submit to that website can’t be seen by anyone other than the website. HTTPS Everywhere is a browser extension made by the non-profit internet group the Electronic Frontier Foundation that automatically loads websites over HTTPS where it’s offered, and allows you to block the minority of websites that don’t support HTTPS. The extension is supported by most browsers, including Chrome, Firefox, Edge, and Opera.

Privacy Badger

Another extension developed by the EFF, Privacy Badger is one of the best all-in-one extensions for blocking invisible third-party trackers on websites. This extension looks at all the components of a web page and learns which ones track you from website to website, and then blocks them from loading in the browser. Privacy Badger also learns as you travel the web, so it gets better over time. And it requires no effort or configuration to work, just install it and leave it to it. The extension is available on most major browsers.

uBlock Origin

Ads are what keeps the internet free, but often at the expense of your personal information. Ads try to learn as much about you — usually by watching your browsing activity and following you across the web — so that they can target you with ads you’re more likely to click on. Ad blockers stop them in their tracks by blocking ads from loading, but also the tracking code that comes with it.

uBlock Origin is a lightweight, simple but effective, and widely trusted ad blocker used by millions of people, but it also has a ton of granularity and customizability for the more advanced user. (Be careful with impersonators: there are plenty of ad blockers that aren’t as trusted that use a similar name.) And if you feel bad about the sites that rely on ads for revenue (including us!), consider a subscription to the site instead. After all, a free web that relies on ad tracking to make money is what got us into this privacy nightmare to begin with.

uBlock Origin works in Chrome, Firefox, and Edge and the extension is open source so anyone can look at how it works.

PixelBlock & ClearURLs

If you thought hidden trackers in websites were bad, wait until you learn about what’s lurking in your emails. Most emails from brand names come with tiny, often invisible pixels that alerts the sender when you’ve opened them. PixelBlock is a simple extension for Chrome browsers that simply blocks these hidden email open trackers from loading and working. Every time it detects a tracker, it displays a small red eye in your inbox so you know.

Most of these same emails also come with tracking links that alerts the sender which links you click. ClearURLs, available for Chrome, Firefox and Edge, sits in your browser and silently removes the tracking junk from every link in your browser and your inbox. That means ClearURLs needs more access to your browser’s data than most of these extensions, but its makers explain why in the documentation.

Firefox Multi-Account Containers

And an honorary mention for Firefox users, who can take advantage of Multi-Account Containers, built by the browser maker itself to help you isolate your browsing activity. That means you can have one container full of your work tabs in your browser, and another container with all of your personal tabs, saving you from having to use multiple browsers. Containers also keep your private personal browsing separate from your work browsing activity. It also means you can put sites like Facebook or Google in a container, making it far more difficult for them to see which websites you visit and understand your tastes and interests. Containers are easy to use and customizable.

technology

via TechCrunch https://techcrunch.com

January 10, 2021 at 12:33PM

Video: A behind-the-scenes look at how Kodak manufactures its film

Video: A behind-the-scenes look at how Kodak manufactures its film

https://ift.tt/3hSKtzF

For anyone wondering what the inside of the Kodak film factory looks like Bill Manning’s video tour of parts of the plant might offer a bit of an insight. Bill, from film-enthusiast website Studio C-41, was invited to see the film manufacturing process at the company’s Rochester headquarters and made a video that combines a little history of the Yellow Giant as well as some behind the scenes footage that shows some of the steps.

In the film a Kodak guide explains what is going on and what certain machines do, while cut-away footage introduces the Kodak founder as well as some of the company’s historic cameras. While obviously the emulsion coating is done in the dark and can’t be shown, we do get to see preparation of the film base, the film in its cut form and parts of the process for making the film canisters.

Studio C-41 also has a podcast interview with Kodak staff from 2018 that goes into more depth about how its film is made.

photography

via News: Digital Photography Review (dpreview.com) https://ift.tt/2burdFr

January 7, 2021 at 09:36AM

Scrape a Website With This Beautiful Soup Python Tutorial

Scrape a Website With This Beautiful Soup Python Tutorial

https://ift.tt/38hRUx0

Beautiful Soup is an open-source Python library. It uses navigating parsers to scrape the content of XML and HTML files. You need data for several analytical purposes. However, if you’re new to Python and web scraping, Python’s Beautiful Soup library is worth trying out for a web scraping project.

With Python’s open-source Beautiful Soup library, you can get data by scraping any part or element of a webpage with maximum control over the process. In this article, we look at how you can use Beautiful Soup to scrape a website.

How to Install Beautiful Soup and Get Started With It

Before we proceed, in this Beautiful Soup tutorial article, we’ll use Python 3 and beautifulsoup4, the latest version of Beautiful Soup. Ensure that you create a Python virtual environment to isolate your project and its packages from the ones on your local machine.

To get started, you must install the Beautiful Soup library in your virtual environment. Beautiful Soup is available as a PyPi package for all operating systems, so you can install it with the pip install beautifulsoup4 command via the terminal.

However, if you’re on Debian or Linux, the above command still works, but you can install it with the package manager by running apt-get install python3-bs4.

Beautiful Soup doesn’t scrape URLs directly. It only works with ready-made HTML or XML files. That means you can’t pass a URL straight into it. To solve that problem, you need to get the URL of the target website with Python’s request library before feeding it to Beautiful Soup.

To make that library available for your scraper, run the pip install requests command via the terminal.

To use the XML parser library, run pip install lxml to install it.

Inspect the Webpage You Wish to Scrape

Before scraping any website you’re not familiar with, a best practice is to inspect its elements. You can do this by switching your browser to the developer’s mode. It’s pretty easy to use Chrome DevTools if you’re using Google Chrome.

However, it’s necessary to inspect a webpage to know more about its HTML tags, attributes, classes, and ids. Doing that exposes the core elements of a webpage and its content types.

It also helps you develop the best strategies you can use to get the exact data you want from a website and how you can get it.

How to Scrape a Websites’ Data With Beautiful Soup

Now that you have everything up and ready, open up a preferred code editor and create a new Python file, giving it a chosen name. However, you can also make use of web-based IDEs like Jupyter Notebook if you’re not familiar with running Python via the command line.

Next, import the necessary libraries:

from bs4 import BeautifulSoup
import requests

First off, let’s see how the requests library works:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com')
print(website)

When you run the code above, it returns a 200 status, indicating that your request is successful. Otherwise, you get a 400 status or some other error statuses that indicate a failed GET request.

Remember to always replace the website’s URL in the parenthesis with your target URL.

Once you get the website with the get request, you then pass it across to Beautiful Soup, which can now read the content as HTML or XML files using its built-in XML or HTML parser, depending on your chosen format.

Take a look at this next code snippet to see how to do this with the HTML parser:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup)

The code above returns the entire DOM of a webpage with its content.

You can also get a more aligned version of the DOM by using the prettify method. You can try this out to see its output:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup.prettify())

You can also get the pure content of a webpage without loading its element with the .text method:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup.text)

How to Scrape the Content of a Webpage by the Tag Name

You can also scrape the content in a particular tag with Beautiful Soup. To do this, you need to include the name of the target tag in your Beautiful Soup scraper request.

For example, let’s see how you can get the content in the h2 tags of a webpage.

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
print(soup.h2)

In the code snippet above, soup.h2 returns the first h2 element of the webpage and ignores the rest. To load all the h2 elements, you can use the find_all built-in function and the for loop of Python:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
h2tags = soup.find_all('h2')
for soups in h2tags:
print(soups)

That block of code returns all h2 elements and their content. However, you can get the content without loading the tag by using the .string method:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
h2tags = soup.find_all('h2')
for soups in h2tags:
print(soups.string)

You can use this method for any HTML tag. All you need to do is replace the h2 tag with the one you like.

However, you can also scrape more tags by passing a list of tags into the find_all method. For instance, the block of code below scrapes the content of a, h2, and title tags:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
tags = soup.find_all(['a', 'h2', 'title'])
for soups in tags:
print(soups.string)

How to Scrape a Webpage Using the ID and Class Name

After inspecting a website with the DevTools, it lets you know more about the id and class attributes holding each element in its DOM. Once you have that piece of information, you can scrape that webpage using this method. It’s useful when the content of a target component is looping out from the database.

You can use the find method for the id and class scrapers. Unlike the find_all method that returns an iterable object, the find method works on a single, non-iterable target, which is the id in this case. So, you don’t need to use the for loop with it.

Let’s look at an example of how you can scrape the content of a page below using the id:

from bs4 import BeautifulSoup
import requests
website = requests.get('http://somewebpages.com/')
soup = BeautifulSoup(website.content, 'html.parser')
id = soup.find(id = 'enter the target id here')
print(id.text)

To do this for a class name, replace the id with class. However, writing class directly results in syntax confusion as Python see it as a keyword. To bypass that error, you need to write an underscore in front of class like this: class_.

In essence, the line containing the id becomes:

my_classes = soup.find(class_ = 'enter the target class name here')
print(my_classes.text)

However, you can also scrape a webpage by calling a particular tag name with its corresponding id or class:

data = soup.find_all('div', class_ = 'enter the target class name here')
print(data)

How to Make a Reusable Scraper With Beautiful Soup

You can create a class and put all the previous code together into a function in that class to make a reusable scraper that gets the content of some tags and their ids. We can do this by creating a function that accepts five arguments: a URL, two tag names, and their corresponding ids or classes.

Assume you want to scrape the price of shirts from an e-commerce website. The example scraper class below extracts the price and shirt tags with their corresponding ids or classes and then returns it as a Pandas data frame with ‘Price’ and Shirt_name as the column names.

Ensure that you pip install pandas via the terminal if you’ve not done so already.

import pandas as pd
class scrapeit:
try:
def scrape(website=None, tag1=None, id1=None, tag2=None, id2=None):
if not (website and tag1 and id1 and tag2 and id2)==None:
try:
page = requests.get(website)
soup = BeautifulSoup(page.content, 'html.parser')
infotag1 = soup.find_all(tag1, id1)
infotag2 = soup.find_all(tag2, id2)
priced = [prices.text for prices in infotag1]
shirt = [shirts.text for shirts in infotag2]
data = {
'Price':priced,
'Shirt_name':shirt}
info = pd.DataFrame(data, columns=['Price', 'Shirt_name'])
print(info)
except:
print('Not successful')
else:
print('Oops! Please enter a website, two tags and thier corresponding ids')
except:
print('Not successful!')

The scraper you just made is a reusable module and you can import and use it in another Python file. To call the scrape function from its class, you use scrapeit.scrape(‘Website URL’, ‘price_tag’, ‘price_id’, ‘shirt_tag’, ‘shirt_id’). If you don’t provide the URL and other parameters, the else statement prompts you to do so.

To use that scaper in another Python file, you can import it like this:

from scraper_module import scrapeit
scrapeit.scrape('URL', 'price_tag', 'price_id', 'shirt_tag', 'shirt_id')

Note: scraper_module is the name of the Python file holding the scraper class.

You can also check the Beautiful Soup documentation if you want to dive deeper into how you can make the best use of it.

Beautiful Soup Is a Valuable Web Scraping Tool

Beautiful Soup is a powerful Python screen scraper that gives you control over how your data comes through during scraping. It’s a valuable business tool, as it can give you access to competitor’s web data like pricing, market trends, and more.

Although we’ve made a tag scraper in this article, you can still play around with this powerful Python library to make more useful scraping tools.

non critical

via MakeUseOf.com https://ift.tt/1AUAxdL

January 6, 2021 at 01:05PM

Manufacturing: How Do They Get the Bristles Into a Toothbrush?

Manufacturing: How Do They Get the Bristles Into a Toothbrush?

https://ift.tt/2L7lJrs

You probably realize toothbrush handles are injection-molded pieces of plastic. But how do they get the nylon bristles into the head? And without using adhesive, how do they get the bristles to stay put?

Here’s how. This is a shot of the machine that loads the bristles into the heads, at actual speed:

Here’s the process from a different angle, slowed down:

The close-up in slow motion, below, provides the answer. The tool that grabs the bristles also folds them in half (off camera) and binds them into a bunch by wrapping them with wire near the fold. In this shot below, you can see the wire binding that’s holding the butt end of the bristles.

The wire binding provides a friction fit in the molded holes, both keeping the bristles together and preventing them from falling out.

Video of the full process below.

fun

via Core77 https://ift.tt/1KCdCI5

January 6, 2021 at 11:49AM

Customize Views

Customize Views

https://ift.tt/2JO98ss


Jetstream allows you to publish all views and Blade components to your project folder, making it easy to customize the look and feel of your application. Let’s review how.

programming

via Laracasts https://ift.tt/1eZ1zac

January 6, 2021 at 10:25AM

Laravel Jetstream v2 is released

Laravel Jetstream v2 is released

https://ift.tt/2Lt3hJt

Laravel Jetstream v2 is now released and available for all. This release features team member invitations, Inertia Authentication Views, Team Switcher Improvements, Accessibility Improvements, Tailwind 2.0 support, and more.

The post Laravel Jetstream v2 is released appeared first on Laravel News.


Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.

programming

via Laravel News https://ift.tt/14pzU0d

January 5, 2021 at 09:21PM

pavel-mironchik/laravel-backup-panel

pavel-mironchik/laravel-backup-panel

https://ift.tt/398sOzS


Laravel Backup Panel

Latest Version on Packagist
Build Status
Quality Score
StyleCI
Total Downloads

Laravel Backup Panel provides a dashboard for spatie/laravel-backup package.
It lets you:

  • create a backup (full | only database | only files)
  • check the health of your backups
  • list all backups
  • download a backup
  • delete a backup
  • monitor used disk storage

Screenshot

It resembles the look and functionality of another Spatie package: spatie/nova-backup-tool.
This was done on purpose, so users can easily migrate from one to another.
Only it doesn’t use polling.
A “real-time” updates of a backups list isn’t such a necessarily thing and an intensive polling can cause unexpected charges if you use services that require to pay per API requests, such as Google Cloud Storage.
Also, some users reported about hitting a rate limit of Dropbox API.

Requirements

Make sure you meet the requirements for installing spatie/laravel-backup.

Installation

First you must install spatie/laravel-backup into your Laravel app.
The installation instructions are here.
When successful, running php artisan backup:run on the terminal should create a backup and php artisan backup:list should return a list with an overview of all backup disks.

You may use composer to install Laravel Backup Panel into your project:

$ composer require pavel-mironchik/laravel-backup-panel

After installing, publish it resources using provided Artisan command:

$ php artisan laravel-backup-panel:install

This will place assets into public/laravel_backup_panel directory, add config file config/laravel_backup_panel.php, and register service provider app/Providers/LaravelBackupPanelServiceProvider.php.

Upgrading

When upgrading the package, do not forget to re-publish assets:

$ php artisan vendor:publish --tag=laravel-backup-panel-assets --force

Configuration

Laravel Backup Panel exposes a dashboard at /backup. Change it in config/laravel_backup_panel.php file:

Sometimes you don’t want to run backup jobs on the same queue as user actions and things that is more time critical.
Specify your desired queue name in config/laravel_backup_panel.php file:

'queue' => 'dedicated_low_priority_queue',

By default, you will only be able to access the dashboard in the local environment.
To change that, modify authorization gate in the app/Providers/LaravelBackupPanelServiceProvider.php:

/**
 * Register the Laravel Backup Panel gate.
 *
 * This gate determines who can access Laravel Backup Panel in non-local environments.
 *
 * @return void
 */
protected function gate()
{
    Gate::define('viewLaravelBackupPanel', function ($user) {
        return in_array($user->email, [
            'admin@your-site.com',
        ]);
    });
}

Usage

Open http://your-site/backup. You’ll see a dashboard and controls to use.

Testing

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Development

Make sure you’ve prepared a dummy Laravel application to test the package in, because assets will be copied there by this line in webpack.mix.js:

.copy('public/vendor/laravel_backup_panel', '../laravel-backup-panel-test/public/vendor/laravel_backup_panel');

Security

If you discover any security related issues, please email mironchikpavel@gmail.com instead of using the issue tracker.

Support

If you like this package, consider supporting it. You can use this in such ways:

  1. If you don’t have a Digital Ocean account yet – use this link https://m.do.co/c/d9cd33e44510 to register one. You will get $100 in credit over 60 days, and once you spent $25 – I will get $25 too. This will cover the cost of hosting my nonprofit open-source projects there.
  2. If you have some Laravel/Vue project/work to be done, then contact me – mironchikpavel@gmail.com. I work as a freelancer (mostly at UpWork), and such a project can pay my bills.

And any other help will be appreciated.

Credits

License

The MIT License (MIT). Please see License File for more information.

programming

via Packalyst :: Latest Packages https://ift.tt/2OrBsQj

January 5, 2021 at 05:10PM