{"id":4270012,"date":"2020-08-04T03:44:08","date_gmt":"2020-08-04T01:44:08","guid":{"rendered":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/"},"modified":"2025-12-08T13:44:29","modified_gmt":"2025-12-08T11:44:29","slug":"how-to-scrape-serp-snippets-with-python-coding","status":"publish","type":"article","link":"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/","title":{"rendered":"How to scrape SERP snippets with Python coding"},"content":{"rendered":"<div class=\"block-article-post-header js-block-article-post-header block-article-post-header__theme--onyxGrey\">\n\t<button\tclass=\"cta-button block-article-post-header__back-button cta-button__color--white cta-button__style--back\" aria-label=\"Back\" >\n\t<svg width='41' height='41' viewBox='0 0 41 41' fill='none' xmlns='http:\/\/www.w3.org\/2000\/svg'><circle cx='20.5' cy='20.5' r='19.5' transform='rotate(-90 20.5 20.5)' stroke='var(--dept-button-icon-outline-color)' stroke-width='1.3' stroke-miterlimit='10' fill='none'\/><circle class='icon-backplate' cx='20.5' cy='20.5' r='19.5' transform='rotate(-90 20.5 20.5)' fill='var(--dept-button-icon-backplate-color)' fill-opacity='1'\/><path class='icon-center' d='M21.174 30 11 20.674l10.174-9.326m-9.326 9.328H30.5' stroke='var(--dept-button-icon-color)' stroke-width='1.3' stroke-miterlimit='10' fill='none'\/><\/svg>\n\t\t\t<span>\n\t\t\tBack to all articles\t\t<\/span>\n\t\n<\/button><h1\t\tclass=\"typography block-article-post-header__title typography__color--white typography__size--h1 typography__align--left\"\n\t\t\t>\n\t\tHow to scrape SERP snippets with Python coding\t<\/h1><div\n\t\tclass=\"image-wrap block-article-post-header__image-wrap\"\n\t\tdata-align=\"center center\"\n\t\t\t>\n\n\t\t\t<picture\n\t\tclass=\"image__picture\"\n\t\t\t\t>\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t<img\n\t\t\t\tsrc=\"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/code-2620118_640.jpg\"\n\t\t\t\tclass=\"image block-article-post-header__image\"\n\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\/>\n\t\t<\/picture>\n\t\n\t<\/div><div class=\"author block-article-post-header__author\" data-animation=\"slide-fade\">\n\t\t\t<img\n\t\t\tclass=\"author__portrait\"\n\t\t\tsrc=\"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/Wes-Flippo-Dept-150x150.jpg\"\n\t\t\talt=\"Wes Flippo\"\n\t\t\/>\n\t\n\t<div class=\"author__text\">\n\t\tWes Flippo\t\t<br \/>\n\t\t \n\t\t\t<\/div>\n<\/div>\n\t<div class=\"block-article-post-header__meta\">\n\t\t\t\t\t\t\t<div class=\"block-article-post-header__meta-date\">\n\t\t\t\t<div class=\"block-article-post-header__date-description\">\n\t\t\t\t\tDate\t\t\t\t<\/div>\n\t\t\t\t<div class=\"block-article-post-header__published-date\">\n\t\t\t\t\t4 August 2020\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--white\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--onyxGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tObtaining visibility in search search snippets is an excellent way to boost CTR and increase organic site traffic. As a quick refresher, below is a visual example of a SERP snippet for the query \u201cpaid search vs. seo\u201d:<br><br>Snippets take up serious SERP real estate, often driving more traffic than a #1 ranking. There are several great hacks on <a href=\"https:\/\/moz.com\/blog\/optimize-featured-snippets\">how to optimize for Google snippets<\/a>, but not many hacks on how to <i>find<\/i> snippet opportunities. The process is very manual. It usually requires the following:\t<\/p><\/div><\/div>\n\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><ul class=\"lists lists__color--onyxGrey lists__type--decimal lists__size--default lists__align--left block-lists__lists\">\n\t<li><span style=\"font-weight: 400\">Search for keywords individually on Google<\/span><\/li><li><span style=\"font-weight: 400\">Record the SERP snippets per keyword<\/span><\/li><li><span style=\"font-weight: 400\">Identify which existing content\/pages can break into those snippets<\/span><\/li><li><span style=\"font-weight: 400\">Edit the content <\/span><\/li><\/ul><\/div><\/div>\n\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--onyxGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tStep 3 is the ultimate takeaway, but about 90% of the work goes into steps 1 and 2. However, what if you could automate finding the snippets and preserve your brainpower for winning the snippets? That\u2019s where Python comes in. As a novice Python coder (If I can even call myself that), I\u2019ve quickly realized that Python can significantly reduce the time for SERP research projects. Snippet research is one of those instances.<br><br>Rather than individually searching\/recording Google snippets for hundreds of keywords, Python can do the grunt work so you can be more efficient with the time spent winning that valuable organic real estate. \t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--onyxGrey\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--white typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPreamble: Change your VPN &amp; don\u2019t perform this operation on a network that multiple parties depend on\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--lightGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tWhile search engine scraping is legal, Google can flag and deny any IP it suspects of bot-like behavior. Therefore, changing proxies is a prerequisite to successfully scraping. If you constantly use the same VPN and IP address for this practice, Google can store your information in its database of repeat offenders. While these bans are usually temporary, they still increase your likelihood of being denied again. This can be especially problematic if your work address is stored on a denylist and none of your coworkers can access Google.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--white\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--onyxGrey typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPart 1: Get Python to read the document\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--onyxGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tFirst, we must list all the keywords we want to search in a Text file. We choose Text files because they\u2019re minimal and easy for Python to handle. Save the file somewhere easy to access, as Python will need to access through your computer. <br><br><i><strong>*WARNING: IF YOU ARE SAVING AS A RICH TEXT DOCUMENT ON MACBOOK (RFT), MAKE SURE TO EDIT THE FILE SO IT IS A .TXT. WE WANT THE SIMPLEST FILE POSSIBLE SO PYTHON DOESN\u2019T WASTE ITS TIME READING HEADER ELEMENTS WITHIN A COMPLICATED WORD PROCESSOR.<\/strong><\/i><br><br>Line 1: <strong>with open(&#8220;\/Users\/Desktop\/Text_Doc_Python1.txt&#8221;, &#8220;r&#8221;) as f:<\/strong><br><br>We instruct Python to open the list of queries from the file\u2019s absolute path on your computer. In this example, the file was on my desktop and was housed under the path \u201c\/Users\/Desktop\/\u201d. The file with my keywords was titled \u201cText_Doc_Python1.txt\u201d. Hence, our open instruction is to open\u00a0 &#8220;\/Users\/Desktop\/Text_Doc_Python1.txt&#8221; In that same line, we\u2019re giving Python read permissions (&#8216;r&#8217;). So now Python can both open and read the file. Lastly, I will define this whole operation of opening and reading the file as \u201cf\u201d. This way,\u00a0 I can refer back to it via a single letter rather than typing out that long file path whenever I want to use it.<br><br>Line 2:<strong> queries = [line.strip() for line in f]<\/strong><br><br>Our keyword list might not be perfect, and there might be some stray spaces following our term. To account for this, we will use line.strip() to remove any stray spaces from before or after the KW; this ensures that the term you think is getting Googled is getting Googled. We will define these cleaned-up line items from our handy \u2018f\u2019 document as \u201cqueries.\u201d This will represent each query we\u2019re going to get a snippet from.<br><br>Line 3: <strong>print(queries)<\/strong><br>For good measure, we\u2019ll also print the queries in our Console to preview what exactly Python will be running through Google search.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--onyxGrey\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--white typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPart 2: Import our packages\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--lightGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tIn Python, we work with modules (aka packages). A module is a piece of software that serves a very specific functionality. In Python, you access modules through the \u201cimport\u201d command. For this specific project, we\u2019ll be importing these packages. I\u2019ll explain why:<br><br>The <strong>selenium webdriver <\/strong>module is what\u2019s going to allow Python to perform searches in Google.<br><br><strong>Requests <\/strong>will supplement webdriver by allowing Python to request a specific search URL from the server.<br><br><strong>BeautifulSoup <\/strong>will let Python analyze that SERP and scrape elements (i.e. the snippet).<br><br><strong>Random<\/strong> generates a random number within a certain defined range. We use random so that each request has a different server request time. If we run hundreds of requests that have the same exact delay time in between each search, Google will assume you are a bot and likely block your IP.<br><br><strong>Time<\/strong> is required to define the sleep period in between searches before Python performs another one. Time works in tandem with the random module in this project.<br><br>The <strong>csv <\/strong>module simply allows Python to interact with and write csv files. When Python is done crawling our list items in Google, we\u2019ll want it to package up the results in a nice CSV document that is ready for analysis.<br><br>Lastly, even though <strong>delay_seconds<\/strong> isn\u2019t a package, we\u2019re going to take care of defining this variable now because we\u2019ll need it later. What we\u2019re doing is using our newly imported random package to give us a random integer between 100 and 500. We\u2019re then dividing that number by 100. So what does that do? It gives us any decimal number between 1.00 and 5.00, which will be used as the amount of seconds our program will wait in between crawls. We\u2019ll explain why that matters later.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--white\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--onyxGrey typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPart 3: Set up Chrome Driver<br>\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--onyxGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tFor the selenium webdriver module to work, Python needs an application to run the searches through. To get this, you will need to install ChromeDriver from https:\/\/chromedriver.chromium.org.<br><br>Once you have chromium installed, you will need to find where it\u2019s located on your computer. <br><br>Much like we did with our open (<strong>&#8220;\/Users\/Desktop\/Text_Doc_Python1.txt<\/strong>&#8221; command, where we needed to tell Python where the file was, what we\u2019re accessing, and what to do with it, we\u2019re doing the same with Chromedriver. We\u2019re telling Python where the browser is and where these searches will be performed.<br><br>In this example, the file was found in <strong>\/Users\/Downloads\/ <\/strong>and the file was called \u201cchromedriver 3\u201d. Ergo, we are defining our chromedriver variable as <strong>&#8220;\/Users\/Downloads\/chromedriver 3&#8221;<\/strong> <br><br>While we\u2019ve defined which application we\u2019ll use to search things, we haven\u2019t yet set a command to search things. driver = webdriver.Chrome(chromedriver) commands Python to automate a search process via webdriver using the chromedriver browser that we just assigned above. We\u2019ve taken this process of automating a search and defined it as <strong>driver<\/strong>.<br><br>So to recap, webdriver is our automation and chromedriver is our Google Chrome application where searches will be automated.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--onyxGrey\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--white typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPart 4: Create a new file where our scraped results will go\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--lightGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tBefore we finally start automating searches, we want to make sure that this data will be packaged up in a file for us once it\u2019s done. The data won\u2019t do much good sitting in a Python console: we need it in a CSV file that we can manipulate and analyze.<br><br>Line 1: <strong>with open(&#8216;innovators.csv&#8217;, &#8216;w&#8217;) as file:<\/strong> <br><br>To do this, we will pull the same <strong>open command<\/strong> we used to access our list of queries earlier. But there\u2019s a core difference with how we\u2019re using it. On the query list, we just wanted Python to read the file (hence the \u201cr\u201d in with <strong>open(&#8220;\/Users\/Desktop\/Text_Doc_Python1.txt&#8221;, &#8220;r.&#8221;<\/strong>). We want Python to write a file, so we\u2019re going with \u2018w\u2019 instead. This whole process of writing to the file I\u2019ve inexplicably named <strong>&#8216;innovators.csv&#8217;<\/strong> will be defined as <strong>file<\/strong>. <br><br>Line 2: <strong>fields = [&#8216;Query&#8217;, &#8216;Snippet&#8217;]<\/strong> <br><br>We will give this file header values of \u2018Query\u2019 and \u2018Snippet.\u2019 We want to easily show a third party<strong> that \u201cColumn A is the search keyword, Column B is the snippet result.\u201d<\/strong> These two headers are being packaged up into an easy variable named <strong>fields<\/strong>. <br><br>Line 3: <strong>writer = csv.writer(file) <\/strong><br><br>I\u2019m now inventing a variable called \u201cwriter\u201d, where we will write onto the <strong>file<\/strong> we defined before.<br><br>Line 4: <strong>writer.writerow(fields) <\/strong><br><br>Now that we\u2019re accessing the file, I can write my <strong>fields <\/strong>onto my csv document. When this script runs and writes a CSV file, my columns will have a header element now. So far, that\u2019s all the document has, though.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--white\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--onyxGrey typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPart 5: Perform the searches\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--onyxGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tLine 1: <strong>for item in queries:<\/strong> <br><br>In our first line, we\u2019re now establishing an important Python function called a \u201c for loop,\u201d which essentially repeats an operation for us. Here, we\u2019re simply instructing our program that we\u2019re about to perform an operation for each query (<strong>or item <\/strong>) from our <strong>queries variable<\/strong> (our full list of queries we defined earlier).<br><br>Line 2: <strong>updated_query = item.replace(&#8221; &#8220;, &#8220;+&#8221;)<\/strong> <br><br>For each query in our doc, we\u2019re now mutating each one into a Google search URL. We know that when you search for something in Google, the URL we get back follows a formula:<br>Query: \u201ctest query\u201d<br>Google URL: <a href=\"https:\/\/www.google.com\/search?q=test+query\">https:\/\/www.google.com\/search?q=test+query <\/a><br><br>Easy enough! First, we must replace each space with a \u201c+\u201d sign. As you see in the Google URL above, \u201ctest query\u201d is transformed into \u201ctest+query\u201d in the Google search URL. We then apply that formula to each query (or <strong>item<\/strong> ) and redefine it as <strong>updated_query<\/strong>. To recap: <br><strong>Item<\/strong> = \u201ctest query\u201d <br><strong>updated_query<\/strong> = \u201ctest+query\u201d<br><br>Line 3: <strong>google_url = &#8220;https:\/\/www.google.com\/search?q=&#8221; + updated_query<\/strong> <br><br>Here, we\u2019re now making another variable called <strong>google_url<\/strong>, simply the Google URL search prefix of <strong>https:\/\/www.google.com\/search?q=<\/strong> followed by our URL-ready <strong>updated_query<\/strong>.<br><br>In these few steps, we\u2019ve now changed \u201ctest query\u201d into <a href=\"https:\/\/www.google.com\/search?q=test+query \">https:\/\/www.google.com\/search?q=test+query <\/a>for each one of our keywords.<br><br>Line 4: <strong>driver.get(google_url) <\/strong><br><br>In Step 3, we defined the action of performing a search on our Google driver as <strong>driver<\/strong>. So now that we have both our Google search operation set up and the specific URL we need to be searched, we\u2019re just instructing driver to perform its operation with our google_url.<br><br>Line 5: <strong>time.sleep(delay_seconds)<\/strong> <br>You may recall that in Part 1, we imported our packages but also made the variable <strong>delay_seconds <\/strong>generate a decimal number between 1 and 5: delay_seconds = random.randint(100, 500)\/100 For each time this script runs, a different number will generate and is assigned as the time.sleep value. time.sleep is the amount of seconds that the program will wait until performing another search. So after each search, the program will wait somewhere between 1.00 and 5.00 seconds before performing the next search.<br><br>Why do we do that? If our program waits for the same exact amount of time in between dozens of searches, Google will figure out pretty quickly that this is a bot performing the search, which increases odds of getting blocked by Google. We use the random value for<strong> time.sleep <\/strong>to anonymize ourselves to prevent this from happening.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--onyxGrey\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--white typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPart 6: Pull the snippets\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--lightGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tLine 1: <strong>soup = BeautifulSoup(driver.page_source,&#8217;lxml&#8217;)<\/strong> The <strong>BeautifulSoup<\/strong> package we imported earlier allows us to pull HTML from a live URL. Meanwhile, <strong>driver<\/strong> has a built-in <strong>page_source<\/strong> attribute that helps our program to parse the HTML of a selected page ( <strong>&#8216;lxml&#8217;<\/strong> is said parcer). We\u2019re defining this whole operation as <strong>soup<\/strong> .<br><br>Line 2: <strong>for s in soup.find_all(id=&#8221;res&#8221;):<\/strong> We\u2019re running another <strong>for<\/strong> loop for every scraped Google result. For every scrape we perform (now defined as <strong>soup<\/strong> ), we want to find all instances of when the page code has an <strong>id<\/strong> value of <strong>\u201dres\u201d<\/strong> (hence <strong>(id=&#8221;res&#8221;)<\/strong> ).<br><br>Why? Because the actual code within Google\u2019s SERP has defined \u201cres\u201d as a DIV id:\t<\/p><\/div><\/div>\n\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--lightGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tYou could choose from a number of other ids found on Google\u2019s SERP, but we went with \u201cres\u201d here.<br><br>Lines 3 &amp; 4: <strong>s = s.text.replace(&#8216;Search ResultsFeatured snippet from the web&#8217;, &#8221;).split(&#8220;\u203a&#8221;)[0]<\/strong> <strong>ns = s.replace(&#8216;Search ResultsWeb results&#8217;, &#8216;No snippet : &#8216;)<\/strong> <br><br>Here we\u2019re just cleaning up the result from our scrape ( <strong>s<\/strong> ) or labeling if our result has returned no snippets. <strong>ns<\/strong> is the variable that will live on because it is searching for a word combination that will ultimately tell us if a snippet exists ( <strong>&#8216;Search ResultsFeatured snippet from the web&#8217;<\/strong> ) or doesn\u2019t exist ( <strong>&#8216;Search ResultsWeb results&#8217;<\/strong> ). If a snippet exists, we\u2019ll get the scraped result back. If it doesn\u2019t exist, the line for that query will read <strong>&#8216;No snippet : &#8216;<\/strong> .<br><br>Line 5 &amp; 6: <strong>data = item, ns<\/strong> <strong>print(data)<\/strong> <br><br>Lastly, we\u2019re just making a variable that organizes the data we want to get back. As you may recall, item is from the beginning of our Part 5 for loop and is the original query we used for our scrape. <strong>ns<\/strong> is our scrape result (which will either yield the scrape result or \u201cNo Snippet\u201d).<br><br>The <strong>print(data)<\/strong> command will then display for us what those results will be.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div class=\"block-title-and-content js-block-title-and-content block-title-and-content__theme--white\">\n\t<div class=\"block-title-and-content__layout\">\n\t\t<h2\t\tclass=\"typography block-title-and-content__title typography__color--onyxGrey typography__size--h2 typography__align--left\"\n\t\tdata-size-mobile=\"h2\" \t>\n\t\tPart 7: Get the scrape results written to our file, ready to analyze\t<\/h2>\n\t\t\t\t\t<div class=\"block-title-and-content__content\">\n\t\t\t\t\n<div class='block-title-and-content__item'><div class='block-title-and-content__item-inner'><p\t\tclass=\"typography block-typography__typography typography__color--onyxGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\t<strong>writer.writerow(data)<br>file.close()<\/strong><br><br>The scraping is done! Now we need to get it into a document we can analyze. You may recall the following code from Part 4.<br><br>So since <strong>writer <\/strong>has already been defined as the action of writing onto our original <strong>&#8216;innovators.csv&#8217;<\/strong> doc, and since we already have <strong>&#8216;Query&#8217;<\/strong> and <strong>&#8216;Snippet&#8217;<\/strong> written onto the doc as column headers (via <strong>writer.writerow(fields)<\/strong> ),\u00a0 we then invoke the writer.writerow command again to write our <strong>data <\/strong>result ( item , which is essentially the query, and ns) which is the snippet result) directly below the appropriate headers in the correct columns.<br><br>Once all the loops have run and are written into our document, we then use <strong>file.close()<\/strong> to close the file. <br><br>Our first query \u201cHow do you get health insurance in Vermont\u201d returned no snippet at the time of the search. Meanwhile, \u201cHow do you get health insurance in West Virginia\u201d did, and we can see the result along with the URL at the very end.<br><br>Now you know how to scrape featured snippets from Google! You can likely make small tweaks to scrape for other features such as People Also Ask fields, but this is a good starting point for your snippet scraping needs.\t<\/p><\/div><\/div>\n\t\t\t<\/div>\n\t\t\t<\/div>\n\n\t\n\t<div class=\"block-title-and-content__social-links\">\n\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"copy\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Copy page link\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tdata-tooltip=\"true\"\n\t\t\t\t\tdata-tooltip-text=\"Link copied to clipboard.\"\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M6.832 15.167l8.333-8.333M9.332 6.001l2.787-2.787a4.715 4.715 0 016.666 0v0a4.715 4.715 0 010 6.667L16 12.668M5.999 9.334l-2.787 2.787a4.715 4.715 0 000 6.666v0a4.715 4.715 0 006.667 0l2.787-2.786' stroke='currentColor' stroke-width='2'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"facebook\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Facebook\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='14' height='22' viewBox='0 0 14 22' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M4.032 22L4 12H0V8h4V5.5C4 1.789 6.298 0 9.61 0c1.585 0 2.948.118 3.345.17v3.88H10.66c-1.8 0-2.15.856-2.15 2.112V8h5.241l-2 4H8.51v10H4.032z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"whatsapp\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Whatsapp\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg xmlns='http: \/\/www.w3.org\/2000\/svg' width='25' height='24' viewBox='0 0 25 24'><path d='M.805 24l1.687-6.163a11.869 11.869 0 01-1.588-5.945C.907 5.335 6.244 0 12.801 0c3.182.001 6.17 1.24 8.415 3.488a11.819 11.819 0 013.481 8.413c-.002 6.558-5.34 11.893-11.896 11.893h-.005c-1.99-.001-3.947-.5-5.685-1.448L.805 24zm6.598-3.807l.361.214a9.874 9.874 0 005.033 1.378h.004c5.45 0 9.885-4.434 9.888-9.885a9.824 9.824 0 00-2.894-6.993 9.823 9.823 0 00-6.99-2.898c-5.454 0-9.89 4.434-9.892 9.884a9.86 9.86 0 001.512 5.26l.235.374-.999 3.648 3.742-.982z' fill='currentColor'\/><path d='M9.825 6.921c-.24-.58-.486-.501-.668-.51-.174-.009-.372-.01-.57-.01-.198 0-.52.074-.793.371-.272.298-1.04 1.017-1.04 2.48 0 1.462 1.065 2.875 1.214 3.073.148.199 2.096 3.2 5.078 4.487.709.306 1.262.49 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.759-.72 2.007-1.413.247-.694.247-1.29.173-1.413-.074-.124-.272-.199-.57-.347-.297-.149-1.758-.868-2.03-.967-.273-.1-.471-.149-.67.149-.198.297-.767.966-.94 1.165-.174.198-.348.223-.645.074-.297-.149-1.255-.462-2.39-1.475-.884-.788-1.48-1.76-1.654-2.058-.173-.298-.018-.459.13-.607.134-.133.298-.347.446-.52.149-.174.199-.298.298-.496.099-.198.05-.372-.025-.52-.074-.15-.669-1.612-.917-2.207z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F&#038;text=How%20to%20scrape%20SERP%20snippets%20with%20Python%20coding\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"twitter\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Twitter\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='25' height='20' viewBox='0 0 25 20' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M24.75 2.3c-.9.4-1.8.7-2.8.8 1-.6 1.8-1.6 2.2-2.7-1 .6-2 1-3.1 1.2-.9-1-2.2-1.6-3.6-1.6-2.7 0-4.9 2.2-4.9 4.9 0 .4 0 .8.1 1.1-4.2-.2-7.8-2.2-10.2-5.2-.5.8-.7 1.6-.7 2.5 0 1.7.9 3.2 2.2 4.1-.8 0-1.6-.2-2.2-.6v.1c0 2.4 1.7 4.4 3.9 4.8-.4.1-.8.2-1.3.2-.3 0-.6 0-.9-.1.6 2 2.4 3.4 4.6 3.4-1.7 1.3-3.8 2.1-6.1 2.1-.4 0-.8 0-1.2-.1 2.2 1.4 4.8 2.2 7.5 2.2 9.1 0 14-7.5 14-14v-.6c1-.7 1.8-1.6 2.5-2.5z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t\t\t<a\n\t\t\t\thref=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.deptagency.com%2Fen-au%2Finsight%2Fhow-to-scrape-serp-snippets-with-python-coding%2F\"\n\t\t\t\tdata-share-url=\"https:\/\/www.deptagency.com\/en-au\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\"\n\t\t\t\tdata-share-title=\"How to scrape SERP snippets with Python coding\"\n\t\t\t\tdata-share-type=\"linkedin\"\n\t\t\t\tclass=\"block-title-and-content__social-links-item js-social-link\"\n\t\t\t\taria-label=\"Share to Linkedin\"\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\n\t\t\t\t\t\t\t>\n\t\t\t\t<svg width='19' height='18' viewBox='0 0 19 18' fill='none' xmlns='http: \/\/www.w3.org\/2000\/svg'><path d='M1.15 17.3h3.6V5.8h-3.6v11.5zM.75 2.1c0 1.2 1 2.1 2.1 2.1 1.2 0 2.1-.9 2.1-2.1 0-1.2-1-2.1-2.1-2.1-1.2 0-2.1 1-2.1 2.1zM14.45 17.3h3.6v-6.2c0-3.1-.7-5.5-4.3-5.5-1.8 0-2.9.9-3.4 1.8V5.8h-3.4v11.5h3.6v-5.7c0-1.5.2-2.9 2.1-2.9 1.8 0 1.8 1.7 1.8 3v5.6z' fill='currentColor'\/><\/svg>\t\t\t<\/a>\n\t\t\t\t<\/div>\n<\/div>\n\n<div\n\tclass=\"cta-text js-cta-text block-cta-text__cta-text cta-text__background-color--platinum cta-text--reduce-spacing cta-text--reduce-top-spacing\"\n\t>\n\t<h6 class=\"heading js-cta-text-content heading__color--richBlack heading__size--l heading__align--left cta-text__content\">\n\t\t\tLearn more about our SEO services<br> <br><a href=\"https:\/\/www.deptagency.com\/?post_type=service&amp;p=4149411\">Explore<\/a>\t<\/h6><\/div>\n\n<div class=\"block-highlighted-item-listing\">\n\t<h2\t\tclass=\"typography block-highlighted-item-listing__title typography__color--onyxGrey typography__size--regular-body typography__align--left\"\n\t\t\t>\n\t\tMore Insights?\t<\/h2><a\tclass=\"cta-button block-highlighted-item-listing__cta-button cta-button__color--onyxGrey cta-button__style--regular\" href=\"https:\/\/www.deptagency.com\/all-insights\/\" >\n\t\n\t\t\t<span>\n\t\t\tView All Insights\t\t<\/span>\n\t\n<\/a>\n\t<div class=\"block-highlighted-item-listing__cards\">\n\t\t<a\tclass=\"universal-item-card universal-item-card__type--article universal-item-card--has-link-decoration\"\n\tdata-theme=\"white\"\n\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/dept-returns-with-the-secret-garden-and-opens-souvenir-shop-with-capsule-collection-at-cannes-lions-2026\/\"\n\t\t\t\ttitle=\"DEPT\u00ae returns with The Secret Garden and opens Souvenir Shop with capsule collection at Cannes Lions 2026\"\n\t\t>\n\t\t\t<div class=\"universal-item-card__backplate universal-item-card__backplate--with-image\"><\/div>\n\t\n\t<div\n\t\tclass=\"image-wrap universal-item-card__image-wrap\"\n\t\tdata-align=\"center center\"\n\t\t\t>\n\n\t\t\t<picture\n\t\tclass=\"image__picture\"\n\t\t\t\t>\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t<img\n\t\t\t\tsrc=\"https:\/\/www.deptagency.com\/wp-content\/uploads\/2026\/05\/Souvenir-Shop-PR-1920x1080-insight-1.png\"\n\t\t\t\tclass=\"image universal-item-card__image\"\n\n\t\t\t\t\t\t\t\talt=\"DEPT\u00ae returns with The Secret Garden and opens Souvenir Shop with capsule collection at Cannes Lions 2026\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\/>\n\t\t<\/picture>\n\t\n\t<\/div><p\t\tclass=\"typography universal-item-card__meta typography__color--darkGrey typography__size--eyebrow-lc typography__align--left\"\n\t\t\t>\n\t\tBRAND &AMP; MEDIA&emsp;\u2022&emsp;In\u00eas Saraiva\t<\/p><h3\t\tclass=\"typography universal-item-card__title typography__color--onyxGrey typography__size--h6 typography__align--left\"\n\t\t\t>\n\t\t<span>DEPT\u00ae returns with The Secret Garden and opens Souvenir Shop with capsule collection at Cannes Lions 2026<\/span>\t<\/h3><button\tclass=\"cta-button universal-item-card__btn cta-button__color--onyxGrey cta-button__style--regular has-parent-hover\" >\n\t\n\t\t\t<span>\n\t\t\tRead Article\t\t<\/span>\n\t\n<\/button>\n\t\n\t<\/a><a\tclass=\"universal-item-card universal-item-card__type--article universal-item-card--has-link-decoration\"\n\tdata-theme=\"white\"\n\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/dept-launches-accelerator-powered-by-adobe-genstudio-for-performance-marketing-to-bridge-ais-execution-gap\/\"\n\t\t\t\ttitle=\"DEPT\u00ae launches accelerator powered by Adobe GenStudio for Performance Marketing to bridge AI\u2019s execution gap\"\n\t\t>\n\t\t\t<div class=\"universal-item-card__backplate universal-item-card__backplate--with-image\"><\/div>\n\t\n\t<div\n\t\tclass=\"image-wrap universal-item-card__image-wrap\"\n\t\tdata-align=\"center center\"\n\t\t\t>\n\n\t\t\t<picture\n\t\tclass=\"image__picture\"\n\t\t\t\t>\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t<img\n\t\t\t\tsrc=\"https:\/\/www.deptagency.com\/wp-content\/uploads\/2026\/04\/DEPTxAdobe-Accelerator_1080x1080-1.png\"\n\t\t\t\tclass=\"image universal-item-card__image\"\n\n\t\t\t\t\t\t\t\talt=\"DEPT\u00ae launches accelerator powered by Adobe GenStudio for Performance Marketing to bridge AI\u2019s execution gap\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\/>\n\t\t<\/picture>\n\t\n\t<\/div><p\t\tclass=\"typography universal-item-card__meta typography__color--darkGrey typography__size--eyebrow-lc typography__align--left\"\n\t\t\t>\n\t\tBRAND &AMP; MEDIA&emsp;\u2022&emsp;In\u00eas Saraiva\t<\/p><h3\t\tclass=\"typography universal-item-card__title typography__color--onyxGrey typography__size--h6 typography__align--left\"\n\t\t\t>\n\t\t<span>DEPT\u00ae launches accelerator powered by Adobe GenStudio for Performance Marketing to bridge AI\u2019s execution gap<\/span>\t<\/h3><button\tclass=\"cta-button universal-item-card__btn cta-button__color--onyxGrey cta-button__style--regular has-parent-hover\" >\n\t\n\t\t\t<span>\n\t\t\tRead Article\t\t<\/span>\n\t\n<\/button>\n\t\n\t<\/a><a\tclass=\"universal-item-card universal-item-card__type--article universal-item-card--has-link-decoration\"\n\tdata-theme=\"white\"\n\t\t\thref=\"https:\/\/www.deptagency.com\/en-au\/insight\/dept-is-the-webby-agency-network-of-the-year\/\"\n\t\t\t\ttitle=\"DEPT\u00ae is the Webby Agency &amp; Network of the Year\"\n\t\t>\n\t\t\t<div class=\"universal-item-card__backplate universal-item-card__backplate--with-image\"><\/div>\n\t\n\t<div\n\t\tclass=\"image-wrap universal-item-card__image-wrap\"\n\t\tdata-align=\"center center\"\n\t\t\t>\n\n\t\t\t<picture\n\t\tclass=\"image__picture\"\n\t\t\t\t>\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t<img\n\t\t\t\tsrc=\"https:\/\/www.deptagency.com\/wp-content\/uploads\/2026\/04\/webby-winners-dept-2026.webp\"\n\t\t\t\tclass=\"image universal-item-card__image\"\n\n\t\t\t\t\t\t\t\talt=\"DEPT\u00ae is the Webby Agency &amp; Network of the Year\"\n\t\t\t\t\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\/>\n\t\t<\/picture>\n\t\n\t<\/div><p\t\tclass=\"typography universal-item-card__meta typography__color--darkGrey typography__size--eyebrow-lc typography__align--left\"\n\t\t\t>\n\t\tNEWS&emsp;\u2022&emsp;Marjan Straathof\t<\/p><h3\t\tclass=\"typography universal-item-card__title typography__color--onyxGrey typography__size--h6 typography__align--left\"\n\t\t\t>\n\t\t<span>DEPT\u00ae is the Webby Agency &amp; Network of the Year<\/span>\t<\/h3><button\tclass=\"cta-button universal-item-card__btn cta-button__color--onyxGrey cta-button__style--regular has-parent-hover\" >\n\t\n\t\t\t<span>\n\t\t\tRead Article\t\t<\/span>\n\t\n<\/button>\n\t\n\t<\/a>\t<\/div>\n<\/div>\n\n<div class=\"block-get-in-touch js-block-get-in-touch\">\n\t<div class=\"block-get-in-touch__column block-get-in-touch__column--left block-get-in-touch__column--richBlack\">\n\t\t<h2 class=\"heading heading__color--white heading__size--xl heading__align--left block-get-in-touch__heading\">\n\t\t\tQuestions?\t<\/h2>\t<\/div>\n\n\t<div class=\"block-get-in-touch__column block-get-in-touch__column--right block-get-in-touch__column--white\">\n\t<div\n\t\tclass=\"image-wrap block-get-in-touch__image-wrap\"\n\t\tdata-align=\"top center\"\n\t\t\t>\n\n\t\t\t<div style=\"background-image:url(https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/Wes-Flippo-Dept.jpg)\" class=\"image image--bg block-get-in-touch__image\" ><\/div>\n\t\n\t<\/div>\t\t\t<div class=\"block-get-in-touch__specialist\">\n\t\t\t\t<p class=\"heading heading__color--richBlack heading__size--xxs heading__align--left block-get-in-touch__subtitle\">\n\t\t\t \t<\/p><h3 class=\"heading heading__color--richBlack heading__size--m heading__align--left block-get-in-touch__person-title\">\n\t\t\tWes Flippo\t<\/h3>\t\t\t<\/div>\n\t\t\n\t\t<button\tclass=\"cta-bar block-get-in-touch__cta-bar js-cta-bar\"\n\tid=\"block-get-in-touch-085d39150bd11d8e5545a2410f78752d\"\n\ttitle=\"Get in touch\"\n\taria-label=\"\"\n\t\t>\n\t<div class=\"cta-bar__container cta-bar__container--size--default\">\n\t\t<div class=\"cta-bar__content\">\n\t\t\t<span class=\"cta-bar__label\">\n\t\t\t\tGet in touch\t\t\t<\/span>\n\t\t\t<i class=\"icon icon icon__color--white icon__size--small icon__arrow-right-circle cta-bar__icon cta-bar__icon\">\n\t<svg width='24' height='24' fill='none' viewBox='0 0 24 24' xmlns='http:\/\/www.w3.org\/2000\/svg'><g class='symbol'><path d='M11.5215 17.2609L17.2607 12L11.5215 6.73912' stroke='currentColor' stroke-width='1.5' stroke-miterlimit='10'\/><path d='M16.7827 12L6.26099 12' stroke='currentColor' stroke-width='1.5' stroke-miterlimit='10'\/><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-width='1.5' stroke-miterlimit='10'\/><\/g><path class='symbol-hover' fill-rule='evenodd' clip-rule='evenodd' d='M23 12C23 5.92487 18.0751 0.999999 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23C18.0751 23 23 18.0751 23 12ZM17.7674 11.4471L12.0283 6.18627L11.0147 7.292L15.3326 11.25L6.26099 11.25L6.26099 12.75L15.3326 12.75L11.0147 16.708L12.0283 17.8137L17.7675 12.5529L18.3706 12L17.7674 11.4471Z' fill='currentColor'\/><\/svg><\/i>\t\t<\/div>\n\t<\/div>\n<\/button>\t<\/div>\n<\/div>\n\n<div\n\tclass=\"flyout-drawer js-flyout-drawer flyout-drawer__position--right\"\n\tdata-trigger=\"#block-get-in-touch-085d39150bd11d8e5545a2410f78752d\"\n\tdata-instant-open=\"false\"\n>\n\t<div class=\"flyout-drawer__left-mobile-backplate\"><\/div>\n\t<div class=\"flyout-drawer__left-backplate\"><\/div>\n\n\t\t<div class=\"flyout-drawer__left\"><\/div>\n\n\t<button\tclass=\"cta-button flyout-drawer__close cta-button__color--white cta-button__style--text-and-icon js-drawer-close has-flipped-icon\" aria-label=\"Close\" >\n\t<svg width='21' height='21' viewBox='0 0 21 21' fill='none' xmlns='http:\/\/www.w3.org\/2000\/svg'><circle cx='10.5' cy='10.5' r='9.5' transform='rotate(-90 10.5 10.5)' stroke='var(--dept-button-icon-outline-color)' stroke-width='1.3' stroke-miterlimit='10' fill='none'\/><circle class='icon-backplate' cx='10.5' cy='10.5' r='9.5' transform='rotate(-90 10.5 10.5)' fill='var(--dept-button-icon-backplate-color)' fill-opacity='1'\/><path class='icon-center' d='m14 7-7 7m0-7 7 7' stroke='var(--dept-button-icon-color)' stroke-width='1.5' fill='none'\/><\/svg>\n\t\t\t<span>\n\t\t\tClose\t\t<\/span>\n\t\n<\/button>\n\t<div class=\"flyout-drawer__right\">\n\t\t<div class=\"pardot-forms block-get-in-touch__pardot-forms js-pardot-forms has-picker\">\n\t\t\t<form action=\"\" class=\"pardot-forms__picker block-get-in-touch__picker js-pardot-forms-picker\" method=\"POST\">\n\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\tfor=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-0\"\n\t\t\t\t\t\tclass=\"pardot-forms__label block-get-in-touch__label js-pardot-forms-label\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname=\"form-pick\"\n\t\t\t\t\t\t\tid=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-0\"\n\t\t\t\t\t\t\tclass=\"pardot-forms__input block-get-in-touch__input js-pardot-forms-input\"\n\t\t\t\t\t\t\tvalue=\"https:\/\/www2.deptagency.com\/l\/321011\/2023-07-28\/2f49nnz\"\n\t\t\t\t\t\t\/>\n\t\t\t\t\t\t<span class=\"pardot-forms__form-title block-get-in-touch__form-title\">\n\t\t\t\t\t\t\tJust Say Hi\t\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/label>\n\t\t\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\tfor=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-1\"\n\t\t\t\t\t\tclass=\"pardot-forms__label block-get-in-touch__label js-pardot-forms-label\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname=\"form-pick\"\n\t\t\t\t\t\t\tid=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-1\"\n\t\t\t\t\t\t\tclass=\"pardot-forms__input block-get-in-touch__input js-pardot-forms-input\"\n\t\t\t\t\t\t\tvalue=\"https:\/\/www2.deptagency.com\/l\/321011\/2023-07-28\/2f49nnz\"\n\t\t\t\t\t\t\/>\n\t\t\t\t\t\t<span class=\"pardot-forms__form-title block-get-in-touch__form-title\">\n\t\t\t\t\t\t\tNew Business\t\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/label>\n\t\t\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\tfor=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-2\"\n\t\t\t\t\t\tclass=\"pardot-forms__label block-get-in-touch__label js-pardot-forms-label\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname=\"form-pick\"\n\t\t\t\t\t\t\tid=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-2\"\n\t\t\t\t\t\t\tclass=\"pardot-forms__input block-get-in-touch__input js-pardot-forms-input\"\n\t\t\t\t\t\t\tvalue=\"https:\/\/www2.deptagency.com\/l\/321011\/2023-07-28\/2f49nnz\"\n\t\t\t\t\t\t\/>\n\t\t\t\t\t\t<span class=\"pardot-forms__form-title block-get-in-touch__form-title\">\n\t\t\t\t\t\t\tPress Inquiries\t\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/label>\n\t\t\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\tfor=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-3\"\n\t\t\t\t\t\tclass=\"pardot-forms__label block-get-in-touch__label js-pardot-forms-label\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname=\"form-pick\"\n\t\t\t\t\t\t\tid=\"block-get-in-touch-pardot-forms-827fb71263d49f28bfb2b5ff961a9863-3\"\n\t\t\t\t\t\t\tclass=\"pardot-forms__input block-get-in-touch__input js-pardot-forms-input\"\n\t\t\t\t\t\t\tvalue=\"https:\/\/www2.deptagency.com\/l\/321011\/2023-07-28\/2f49nnz\"\n\t\t\t\t\t\t\/>\n\t\t\t\t\t\t<span class=\"pardot-forms__form-title block-get-in-touch__form-title\">\n\t\t\t\t\t\t\tWorking at DEPT\u00ae\t\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/label>\n\t\t\t\t\t\t\t<\/form>\n\t\t<iframe\n\t\tdata-initial-src=\"\"\n\t\tclass=\"pardot-forms__embed block-get-in-touch__embed js-pardot-forms-embed\"\n\t\ttype=\"text\/html\"\n\t><\/iframe>\n\t<div class=\"loader pardot-forms__loader loader__color--hanPurple js-pardot-forms-loader\">\n\t<div class=\"loader__first\"><\/div>\n\t<div class=\"loader__second\"><\/div>\n<\/div><\/div>\t<\/div>\n\n\t<button\tclass=\"cta-button flyout-drawer__back cta-button__color--onyxGrey cta-button__style--text-and-icon js-drawer-back has-small-icon\" aria-label=\"Back\" >\n\t<svg width='41' height='41' viewBox='0 0 41 41' fill='none' xmlns='http:\/\/www.w3.org\/2000\/svg'><circle cx='20.5' cy='20.5' r='19.5' transform='rotate(-90 20.5 20.5)' stroke='var(--dept-button-icon-outline-color)' stroke-width='1.3' stroke-miterlimit='10' fill='none'\/><circle class='icon-backplate' cx='20.5' cy='20.5' r='19.5' transform='rotate(-90 20.5 20.5)' fill='var(--dept-button-icon-backplate-color)' fill-opacity='1'\/><path class='icon-center' d='M21.174 30 11 20.674l10.174-9.326m-9.326 9.328H30.5' stroke='var(--dept-button-icon-color)' stroke-width='1.3' stroke-miterlimit='10' fill='none'\/><\/svg>\n\t\t\t<span>\n\t\t\tBack\t\t<\/span>\n\t\n<\/button><\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":40,"featured_media":4270013,"template":"","meta":{"_acf_changed":false,"es_utils_meta_schema":"","member_job_title":"","member_linkedin_url":"","dept_alt_featured_image":[],"dept_algolia_noindex":false,"dept_algolia_featured":false,"footnotes":""},"insight-topics":[42718,42719],"person":[41452],"class_list":["post-4270012","article","type-article","status-publish","has-post-thumbnail","hentry"],"acf":{"dept_is_3q_page":false,"dept_insight_featured":true,"dept_current_cpt_partner":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to scrape SERP snippets with Python coding - DEPT\u00ae<\/title>\n<meta name=\"description\" content=\"Python code can help advertisers find featured snippet opportunities that are likely to help increase site traffic &amp; boost CTR. Learn how easy it is to do!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to scrape SERP snippets with Python coding - DEPT\u00ae\" \/>\n<meta property=\"og:description\" content=\"Python code can help advertisers find featured snippet opportunities that are likely to help increase site traffic &amp; boost CTR. Learn how easy it is to do!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/\" \/>\n<meta property=\"og:site_name\" content=\"DEPT\u00ae\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-08T11:44:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/code-2620118_640.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"320\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/\"},\"author\":{\"name\":\"Alexandra Moorhouse\",\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/en-uki\\\/#\\\/schema\\\/person\\\/57d70812ce2b4e6d6b8cd6afd8963ce1\"},\"headline\":\"How to scrape SERP snippets with Python coding\",\"datePublished\":\"2020-08-04T01:44:08+00:00\",\"dateModified\":\"2025-12-08T11:44:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/\"},\"wordCount\":8,\"image\":{\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.deptagency.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/code-2620118_640.jpg\",\"inLanguage\":\"en-AU\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/\",\"url\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/\",\"name\":\"How to scrape SERP snippets with Python coding - DEPT\u00ae\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/en-uki\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.deptagency.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/code-2620118_640.jpg\",\"datePublished\":\"2020-08-04T01:44:08+00:00\",\"dateModified\":\"2025-12-08T11:44:29+00:00\",\"description\":\"Python code can help advertisers find featured snippet opportunities that are likely to help increase site traffic & boost CTR. Learn how easy it is to do!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/#breadcrumb\"},\"inLanguage\":\"en-AU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-AU\",\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.deptagency.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/code-2620118_640.jpg\",\"contentUrl\":\"https:\\\/\\\/www.deptagency.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/code-2620118_640.jpg\",\"width\":640,\"height\":320},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/insight\\\/how-to-scrape-serp-snippets-with-python-coding\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.deptagency.com\\\/en-au\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to scrape SERP snippets with Python coding\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/en-uki\\\/#website\",\"url\":\"https:\\\/\\\/www.deptagency.com\\\/en-uki\\\/\",\"name\":\"DEPT\u00ae\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.deptagency.com\\\/en-uki\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-AU\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.deptagency.com\\\/en-uki\\\/#\\\/schema\\\/person\\\/57d70812ce2b4e6d6b8cd6afd8963ce1\",\"name\":\"Alexandra Moorhouse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-AU\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e8ce4f04a43020c00db84d54b1c54ed8dba8b0de0b959126c45106f23e6ecb9a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e8ce4f04a43020c00db84d54b1c54ed8dba8b0de0b959126c45106f23e6ecb9a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e8ce4f04a43020c00db84d54b1c54ed8dba8b0de0b959126c45106f23e6ecb9a?s=96&d=mm&r=g\",\"caption\":\"Alexandra Moorhouse\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to scrape SERP snippets with Python coding - DEPT\u00ae","description":"Python code can help advertisers find featured snippet opportunities that are likely to help increase site traffic & boost CTR. Learn how easy it is to do!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/","og_locale":"en_US","og_type":"article","og_title":"How to scrape SERP snippets with Python coding - DEPT\u00ae","og_description":"Python code can help advertisers find featured snippet opportunities that are likely to help increase site traffic & boost CTR. Learn how easy it is to do!","og_url":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/","og_site_name":"DEPT\u00ae","article_modified_time":"2025-12-08T11:44:29+00:00","og_image":[{"width":640,"height":320,"url":"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/code-2620118_640.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/#article","isPartOf":{"@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/"},"author":{"name":"Alexandra Moorhouse","@id":"https:\/\/www.deptagency.com\/en-uki\/#\/schema\/person\/57d70812ce2b4e6d6b8cd6afd8963ce1"},"headline":"How to scrape SERP snippets with Python coding","datePublished":"2020-08-04T01:44:08+00:00","dateModified":"2025-12-08T11:44:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/"},"wordCount":8,"image":{"@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/#primaryimage"},"thumbnailUrl":"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/code-2620118_640.jpg","inLanguage":"en-AU"},{"@type":"WebPage","@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/","url":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/","name":"How to scrape SERP snippets with Python coding - DEPT\u00ae","isPartOf":{"@id":"https:\/\/www.deptagency.com\/en-uki\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/#primaryimage"},"image":{"@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/#primaryimage"},"thumbnailUrl":"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/code-2620118_640.jpg","datePublished":"2020-08-04T01:44:08+00:00","dateModified":"2025-12-08T11:44:29+00:00","description":"Python code can help advertisers find featured snippet opportunities that are likely to help increase site traffic & boost CTR. Learn how easy it is to do!","breadcrumb":{"@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/#breadcrumb"},"inLanguage":"en-AU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/"]}]},{"@type":"ImageObject","inLanguage":"en-AU","@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/#primaryimage","url":"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/code-2620118_640.jpg","contentUrl":"https:\/\/www.deptagency.com\/wp-content\/uploads\/2023\/03\/code-2620118_640.jpg","width":640,"height":320},{"@type":"BreadcrumbList","@id":"https:\/\/www.deptagency.com\/insight\/how-to-scrape-serp-snippets-with-python-coding\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.deptagency.com\/en-au\/"},{"@type":"ListItem","position":2,"name":"How to scrape SERP snippets with Python coding"}]},{"@type":"WebSite","@id":"https:\/\/www.deptagency.com\/en-uki\/#website","url":"https:\/\/www.deptagency.com\/en-uki\/","name":"DEPT\u00ae","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.deptagency.com\/en-uki\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-AU"},{"@type":"Person","@id":"https:\/\/www.deptagency.com\/en-uki\/#\/schema\/person\/57d70812ce2b4e6d6b8cd6afd8963ce1","name":"Alexandra Moorhouse","image":{"@type":"ImageObject","inLanguage":"en-AU","@id":"https:\/\/secure.gravatar.com\/avatar\/e8ce4f04a43020c00db84d54b1c54ed8dba8b0de0b959126c45106f23e6ecb9a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e8ce4f04a43020c00db84d54b1c54ed8dba8b0de0b959126c45106f23e6ecb9a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e8ce4f04a43020c00db84d54b1c54ed8dba8b0de0b959126c45106f23e6ecb9a?s=96&d=mm&r=g","caption":"Alexandra Moorhouse"}}]}},"_links":{"self":[{"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/insight\/4270012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/types\/article"}],"author":[{"embeddable":true,"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/users\/40"}],"version-history":[{"count":1,"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/insight\/4270012\/revisions"}],"predecessor-version":[{"id":4375514,"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/insight\/4270012\/revisions\/4375514"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/media\/4270013"}],"wp:attachment":[{"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/media?parent=4270012"}],"wp:term":[{"taxonomy":"insight-topic","embeddable":true,"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/insight-topics?post=4270012"},{"taxonomy":"person","embeddable":true,"href":"https:\/\/www.deptagency.com\/en-au\/wp-json\/wp\/v2\/person?post=4270012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}