Skip to main content

A collection of tools for use with writing SEO-related programs in Python.

Project description

version downloads license python-version

SEOtools 🛠️

A set of utilities for SEOs and web developers with which to complete common tasks.

With SEOtools, you can:

  1. Programatically add links to related posts in content.
  2. Calculate PageRank on internal links from your sitemap.
  3. Identify broken links on a web page.
  4. Recommend a post to use as canonical for a given keyword.
  5. Find the distance of pages from your home page.

And more!

Installation 💻

You can install SEOtools using pip:

pip install seotools

Quickstart 🚀

Create a link graph

from seotools.app import Analyzer

# load from disk will load the link graph from disk if it has already been created
# otherwise, a new link graph will be created
analyzer = Analyzer("https://jamesg.blog/sitemap.xml", load_from_disk=True)

Get pagerank of a URL

print(analyzer.pagerank["https://jamesg.blog"])

Add relevant internal links to a web page

import markdown

article = markdown.markdown(BeautifulSoup(article.text, "html.parser").get_text())

keyword_replace_count = 0

for keyword, url in keyword_map.items():
    if keyword_replace_count >= MAX_KEYWORD_REPLACE:
        break

    article = article.replace(keyword, f"<a href='{url}'>{keyword}</a>", 1)
    keyword_replace_count += 1

print(article)

Recommend related content for a "See Also" section

article = requests.get("https://jamesg.blog/...")

article = markdown.markdown(BeautifulSoup(article.text, "html.parser").get_text())

urls = analyzer.recommend_related_content(article.text)

Check if a page contains a particular JSON-LD object

from seotools import page_contains_jsonld
import requests

content = requests.get("https://jamesg.blog")

print(page_contains_jsonld(content, "FAQPage"))

Get subfolders in a sitemap

analyzer.get_subpaths()

Get distance of URL from home page

analyzer.get_distance_from_home_page("https://jamesg.blog/2023/01/01/")

Retrieve keywords that appear more than N times on a web page

from seotools import get_keywords
import requests
from bs4 import BeautifulSoup

article = requests.get("https://jamesg.blog/...").text
parsed_article = BeautifulSoup(article, "html.parser").get_text()

# get keywords that appear more than 10 times
keywords = get_keywords(parsed_article, 10)

See Also 📚

License 📝

This project is licensed under an MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seotools-0.1.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seotools-0.1.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file seotools-0.1.2.tar.gz.

File metadata

  • Download URL: seotools-0.1.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for seotools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 82d9f99fa0129105f5077e22d246fa78fd4882df2380b388be3e2eb471b5b908
MD5 0aad5e945f51a058156c6b705243ba46
BLAKE2b-256 4e847243c962a2be4f8f64860b2a3125366be8823a714aedb8b0579f829ce645

See more details on using hashes here.

File details

Details for the file seotools-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: seotools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for seotools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce76040452631ef12656db6b25b50733dfb95657b534c59ee5c3945ee7d067c2
MD5 d36822c201ec9cf2e9cf4237e3cb7206
BLAKE2b-256 59bc7bd118e5f1835e2cbc9fbec91a1ad19a7d510d6018bba00d50fc99ca899d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page