Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/capjamesg/seotools
A set of utilities for SEOs and web developers with which to complete common tasks.
https://github.com/capjamesg/seotools
link-graph seo seo-optimization
Last synced: 2 months ago
JSON representation
A set of utilities for SEOs and web developers with which to complete common tasks.
- Host: GitHub
- URL: https://github.com/capjamesg/seotools
- Owner: capjamesg
- License: mit
- Created: 2023-08-03T19:32:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-07T10:24:40.000Z (over 1 year ago)
- Last Synced: 2024-10-04T17:56:44.202Z (3 months ago)
- Topics: link-graph, seo, seo-optimization
- Language: Python
- Homepage: https://capjamesg.github.io/SEOtools/
- Size: 1.48 MB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![version](https://badge.fury.io/py/seotools.svg?)](https://badge.fury.io/py/seotools)
[![downloads](https://img.shields.io/pypi/dm/seotools)](https://pypistats.org/packages/seotools)
[![license](https://img.shields.io/pypi/l/seotools?)](https://github.com/capjamesg/seotools/blob/main/LICENSE)
[![python-version](https://img.shields.io/pypi/pyversions/seotools)](https://badge.fury.io/py/mf2py)# 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:
```bash
pip install seotools
```## Quickstart 🚀
### Create a link graph
```python
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
```python
print(analyzer.pagerank["https://jamesg.blog"])
```### Add relevant internal links to a web page
```python
import markdownarticle = 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:
breakarticle = article.replace(keyword, f"{keyword}", 1)
keyword_replace_count += 1print(article)
```### Recommend related content for a "See Also" section
```python
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
```python
from seotools import page_contains_jsonld
import requestscontent = requests.get("https://jamesg.blog")
print(page_contains_jsonld(content, "FAQPage"))
```### Get subfolders in a sitemap
```python
analyzer.get_subpaths()
```### Get distance of URL from home page
```python
analyzer.get_distance_from_home_page("https://jamesg.blog/2023/01/01/")
```### Retrieve keywords that appear more than N times on a web page
```python
from seotools import get_keywords
import requests
from bs4 import BeautifulSouparticle = 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 📚
- [getsitemap](https://github.com/capjamesg/getsitemap): Retrieve URLs in a sitemap. ([Web interface](https://getsitemapurls.com))
## License 📝
This project is licensed under an [MIT license](https://github.com/capjamesg/SEOtools/blob/main/LICENSE).