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 / serpapi_scrape_google_scholar_organic_results.py
Last active May 20, 2021 09:43
Scrape Google Scholar Organic Results with SerpApi
from serpapi import GoogleSearch
import os, json
params = {
"api_key": os.getenv("API_KEY"),
"engine": "google_scholar",
"q": "samsung",
}
search = GoogleSearch(params)
@dimitryzub
dimitryzub / scrape_google_scholar_profile_results.py
Last active May 23, 2021 12:11
Scrape Google Scholar Profile Results with Python
from bs4 import BeautifulSoup
import requests, lxml, os
headers = {
'User-agent':
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"
}
proxies = {
'http': os.getenv('HTTP_PROXY')
@dimitryzub
dimitryzub / serpapi_scrape_google_scholar_profile_results.py
Last active May 23, 2021 12:13
Scrape Google Scholar Profile Results using SerpApi
from serpapi import GoogleSearch
import os
params = {
"api_key": os.getenv("API_KEY"),
"engine": "google_scholar_profiles",
"hl": "en",
"mauthors": "samsung"
}
@dimitryzub
dimitryzub / serpapi_scrape_author_co_author_results.py
Last active May 29, 2021 10:38
Scrape Google Scholar Author Co-Authors Results with SerpApi
from serpapi import GoogleSearch
import os
params = {
"api_key": os.getenv("API_KEY"),
"engine": "google_scholar_author",
"author_id": "m8dFEawAAAAJ",
"hl": "en",
}
@dimitryzub
dimitryzub / python_scrape_google_scholar_profile_author_results.py
Last active May 29, 2021 10:39
Scrape Google Scholar Profile-Author Results with Python
from bs4 import BeautifulSoup
import requests, lxml, os, json
headers = {
'User-agent':
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582"
}
proxies = {
'http': os.getenv('HTTP_PROXY')
@dimitryzub
dimitryzub / serpapi_full_example_scrape_google_scholar_profile_author_results.py
Last active May 30, 2021 05:19
Full Example: Scrape Google Scholar Profile and Author Results with SerpApi
from serpapi import GoogleSearch
import os
def serpapi_scrape_profile_results_combo():
params = {
"api_key": os.getenv("API_KEY"),
"engine": "google_scholar_profiles",
"hl": "en",
"mauthors": "samsung"
}
@dimitryzub
dimitryzub / hltv_csgo_scrape_match_data.py
Last active June 6, 2021 16:37
HLTV CS:GO Scrape Match Stats
# Website was dynamically updated so requests-html was used instead of bs4
from requests_html import HTMLSession
import csv
session = HTMLSession()
with open('csgo_match_stats.csv', mode='w', newline='', encoding='utf8') as csv_file:
# fieldnames needs to be the same as while doing .appned()
fieldnames = ['Left Team', 'Left Team Score', 'Right Team Score', 'Right Team', 'Event Name']
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
@dimitryzub
dimitryzub / baidu_get_organic_results.py
Created June 18, 2021 19:23
baidu_scrape_organic_results
from bs4 import BeautifulSoup
import requests, lxml, json
headers = {
"User-Agent":
"Mozilla/5.0 (Linux; Android 10; HD1913) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Mobile Safari/537.36 EdgA/46.1.2.5140"
}
def get_organic_results():
@dimitryzub
dimitryzub / baidu_serpapi_get_organic_results.py
Created June 18, 2021 19:24
baidu_serpapi_scrape_organic_results
import os, json
from serpapi import BaiduSearch
def get_organic_results():
params = {
"engine": "baidu",
"q": "minecraft",
"api_key": os.getenv("API_KEY"),
}
@dimitryzub
dimitryzub / baidu_get_answer_box.py
Created June 18, 2021 19:25
baidu_scrape_answer_box
from bs4 import BeautifulSoup
import requests, lxml, re, json
headers = {
"User-Agent":
"Mozilla/5.0 (Linux; Android 10; HD1913) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Mobile Safari/537.36 EdgA/46.1.2.5140"
}
def get_answerbox_result():