Coder Social home page Coder Social logo

suleman-elahi / wpbrokencheck Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 3.0 28 KB

A script to check broken links on any WordPress website. Checks all the posts, looks for broken internal and external links and save them in a CSV file.

Python 100.00%
broken-link-finder broken-links pyhon python3 pythonscript wordpress wordpress-api

wpbrokencheck's Introduction

WpBrokenCheck

HitCount

This is a simple Python script you can use to find out broken links on a WordPress website. It uses WordPress's API v2 to get all the published posts and scans all the links inside including internal links, external links, attachments, images, etc.

At the end, it saves a CSV file in the current working directory. By default, all the links are stored in the CSV file. Later, you can filter them using Excel or LibreOffice.

Running:

  1. Install Python
  2. Install Poetry
  3. Run poetry install
  4. Run as poetry run python WpBrokenCheck.py [Domain] [CSV_FileName]
  5. Example: poetry run python WpBrokenCheck.py example.com example.csv

Note : Only type domain without http:// or https://

Tip : If target website has large number of posts then change max_workers from 5 to 10 at line 60.

Linters:

There are the following Python linters:

  • black for code formatting
  • flake8 code formatting and line brakes (PEP8)
  • isort for reordering imports

They are run via pre-commit as you commit the code to the repository. You can also run it manually on all files by: pre-commit run --all-files

To Do:

  • Make it filter specific codes.
  • Make it run on customized WP sites
  • Push binary releases

PRs and suggestions are welcome :)

wpbrokencheck's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wpbrokencheck's Issues

Most are false positives for me

I tried the program on the same site that you have shown in the screenshot (codeitbro.com). I found that almost all of the links in the csv generated are not broken links. Do you think it could be a network issue? Anyway, just wanted to bring it to your notice.

example.csv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.