Skip to content

Instantly share code, notes, and snippets.

View hamletbatista's full-sized avatar

Hamlet Batista hamletbatista

View GitHub Profile
import requests
from urllib.parse import urlencode, urlparse, urlunparse, quote
import pandas as pd
#def get_seo_branded_data(brand, domain, database="us", export_columns="Ph,Po,Nq,Ur,Tg,Td,Ts", display_limit=10000, display_filter="+|Ph|Co|{brand}"):
#Found that SERP features is -> Fl in https://www.semrush.com/api-analytics/#columns
def get_serp_features(domain, database="us", export_columns="Ph,Fk", display_limit=100):
global key
import json
from jsonpath_ng import jsonpath, parse
def get_content_formats(filename):
content_formats = dict()
image = parse("$..image")
video = parse("$..embedUrl")
local_business = parse("$..address")
#let's build a pandas dataframe with the search console data
import pandas as pd
def get_search_console_data(webproperty, days=-365):
if webproperty is not None:
query = webproperty.query.range(start='today', days=days).dimension('date', 'query')
r = query.get()
df = pd.DataFrame(r.rows)
return df
yaml_config="""
input_features:
-
name: Original_Title
type: text
level: word
encoder: t5
reduce_output: null
-
name: Keyword
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 5 columns, instead of 3. in line 7.
,Optimized_Title,Original_Title,Keyword,Optimized
15,How to Add Links to Instagram Stories with Swipe-Up,How to Add link to Instagram Stories with twitter,how to add link to instagram story,90
18,How to Make Money on Instagram: 3 Foolproof Strategies,How to Make Money on Instagram: 3 good Strategies,how to make money on instagram,91
21,How to Add Links to Instagram Stories with Swipe-Up,How to Add link to Instagram Stories with twitter,how to add a link to instagram story,90
29,How to Create Beautiful Instagram Highlight Covers (40 Free Icons),How to Create Beautiful Instagram cover Covers (40 Free Icons),instagram highlight covers,89
48,How to Schedule Instagram Posts: A Simple Step-By-Step Guide,How to make Instagram in A Simple Step-By-Step Guide,schedule instagram posts,84
51,Want to Buy Instagram Followers? Here's What Happens When You Do,Want to Buy Instagram friends? Here's What Happens When You Do,how to buy instagram followers,92
53,How to Add Links to Instagram Stories with Swipe-Up,How to Add link
() => {
var data = {};
//referring page
data["referring_page"] = document.querySelector('#yDmH0d > c-wiz:nth-child(20) > div > div.OoO4Vb > span > div > div.y3IDJd.rFZTte.Fx3kmc > content > div.shSP > div > div > div:nth-child(3) > content > div > div > div > div.V8vvZb > div > div > content > div.I1NQYe > div:nth-child(1) > div:nth-child(3) > div:nth-child(2) > div > div') ||
document.querySelector('#yDmH0d > c-wiz:nth-child(20) > div > div.OoO4Vb > div.shSP > div > div > div:nth-child(3) > content > div > div > div > div.V8vvZb > div > div > content > div.I1NQYe > div:nth-child(1) > div:nth-child(3) > div:nth-child(2) > div');
//last crawl
data["last_crawl"] = document.querySelector('#yDmH0d > c-wiz:nth-child(20) > div > div.OoO4Vb > span > div > div.y3IDJd.rFZTte.Fx3kmc > content > div.shSP > div > div > div:nth-child(3) > content > div > div > div > div.V8vvZb > div > div > content > div.I1NQYe > div:nth-child(2) > div:
product_id="online:en:US:XX-XXXXX-XXXX-XX"
merchant_id = XXXXXXX
product = service.products().get(
merchantId=merchant_id, productId=product_id).execute()
#partial example product result
"""{'adwordsRedirect': 'https://www.website.com/product/product_url?code=XXX',
'ageGroup': 'adult',
'availability': 'in stock',
from shopping.content import common
# Authenticate and construct service.
service, config, _ = common.init([], __doc__)
#Example Output
#Using service account credentials from /root/shopping-samples/content/service-account.json.
#Merchant Center XXXXXXX is not an MCA.
#Website for Merchant Center XXXXXXX: https://www.sitename.com
MAX_PAGE_SIZE = 10
MAX_RESULT = 20
merchant_id = XXXXXXX
#execute list API
request = service.products().list(
merchantId=merchant_id, maxResults=MAX_PAGE_SIZE)
#iterate over results and stop at MAX_RESULT products
count = MAX_RESULT
import streamlit as st
from ludwig.api import LudwigModel
import pandas as pd
st.cache(show_spinner=False)
def load_model():
#Update with the path to the Ludwig trained model
model = LudwigModel.load("results/experiment_run_1/model/")
return model