Skip to content

Instantly share code, notes, and snippets.

View dimitryzub's full-sized avatar
🇺🇦
Grateful

Dmitiry Zub☀️ dimitryzub

🇺🇦
Grateful
View GitHub Profile
@dimitryzub
dimitryzub / researchgate-search-questions.py
Last active September 14, 2022 10:01
Scrape ResearchGate Search - All Questions
# Blog post: https://serpapi.com/blog/web-scraping-all-questions-from-researchgate-search-in-python/
from parsel import Selector
from playwright.sync_api import sync_playwright
import json
def scrape_researchgate_questions(query: str):
with sync_playwright() as p:
@dimitryzub
dimitryzub / scrape-google-finance-markets-page.py
Last active August 2, 2022 09:37
Script for scraping Google Finance Markets with Python
# tutorial blog post: https://serpapi.com/blog/scrape-google-finance-markets-in-python/
import requests
import json
import re
import argparse
from parsel import Selector
parser = argparse.ArgumentParser(prog="Google Finance Markets Options")
parser.add_argument('-i','--indexes', action="store_true")
@dimitryzub
dimitryzub / scrape-google-finance-main-page.py
Created July 28, 2022 10:38
Script for scraping Google Finance main page in Python 🐍
# original blog post: https://serpapi.com/blog/web-scraping-google-finance/
import requests, json, re
from parsel import Selector
def scrape_google_finance_main_page():
# https://docs.python-requests.org/en/master/user/quickstart/#custom-headers
# https://www.whatismybrowser.com/detect/what-is-my-user-agent
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36"
@dimitryzub
dimitryzub / webscraping-all-goolgle-news-articles.py
Created July 13, 2022 10:06
How to Web Scrape all Google News Articles with Python and SerpApi
# video tutorial: https://www.youtube.com/watch?v=fOs_eOsLP54
from serpapi import GoogleSearch
from urllib.parse import (parse_qsl, urlsplit)
params = {
"api_key": "...", # serpapi api key
"engine": "google", # search engine
"q": "minecraft", # search query
"gl": "us", # country of the search
@dimitryzub
dimitryzub / serpapi-google-sports-results-timezone-format.py
Created July 5, 2022 11:10
#AskSerpApi: "When using sport results API, what timezone do you guys use? The time and date responses are changing."
# AskSerpApi video: https://www.youtube.com/watch?v=c26LgucCqDo
from dateutil import parser
from serpapi import GoogleSearch
params = {
"api_key": "your serpapi api key",
"engine": "google",
"q": "liverpool",
"google_domain": "google.co.uk",
@dimitryzub
dimitryzub / scrape-youtube-videos-python-serpapi.py
Last active July 4, 2022 06:06
Web Scraping YouTube Popular Videos Results Data with Python and SerpApi
# video tutorial: https://www.youtube.com/watch?v=PTLpbBiz_sc
from serpapi import GoogleSearch
from urllib.parse import (parse_qsl, urlsplit)
import json
params = {
"api_key": "your api key", # your serpapi api key
"engine": "youtube", # serpapi parsing engine
"search_query": "blender foundation", # search query
@dimitryzub
dimitryzub / scrape-google-maps-photos-python.py
Last active June 22, 2022 17:12
Web Scrape Google Maps Photos with Python and SerpApi
# video: https://www.youtube.com/watch?v=XM9d8zTYp_U
from serpapi import GoogleSearch
from urllib.parse import urlsplit, parse_qsl
import json
params = {
"api_key": "serpapi api key", # your api key
"engine": "google_maps_photos", # serpapi search engine
"hl": "en", # language of the search
@dimitryzub
dimitryzub / scrape-google-maps-place-python.py
Created June 22, 2022 06:48
Web Scraping Google Maps Place in Python | SerpApi
# video: https://www.youtube.com/watch?v=jqoNHXiGeZA
from serpapi import GoogleSearch
import json
params = {
"api_key": "your-serpapi-api-key", # Your SerpApi Api key
"engine": "google_maps", # SerpApi Parsing Engine
"google_domain": "google.com", # Google domain
"ll": "@47.6062572,-122.4086176,12z", # GPS Coordinates
@dimitryzub
dimitryzub / scrape-google-maps-place-reviews-python.py
Created June 22, 2022 06:46
How to scrape all Google Maps Reviews in Python | SerpApi
# video: https://www.youtube.com/watch?v=HQAWQPNjw_k
from serpapi import GoogleSearch
from urllib.parse import urlsplit, parse_qsl
import json
params = {
"api_key": "your sepapi api key", # your api key
"engine": "google_maps_reviews", # serpapi search engine
"hl": "en", # language of the search
@dimitryzub
dimitryzub / google-rank-tracker.py
Last active June 16, 2022 09:30
Google Rank Tracker in Python | Competitor Tracker
from serpapi import GoogleSearch
from datetime import date
import pandas as pd
import json
def google_website_ranker():
keywords = pd.read_csv("sample-keywords.csv")["Keywords"].to_list()
target_websites = pd.read_csv("sample-keywords.csv")["Target-Website"].to_list()