-
Alternative sites for the project (unofficials)
+
Alternative sites for the project (unofficials)
Free APIs •
Dev Resources •
From f921f4ec5dbf3901e4a141d01301ba80dbdd4753 Mon Sep 17 00:00:00 2001
From: Matheus Felipe <50463866+matheusfelipeog@users.noreply.github.com>
Date: Tue, 24 Aug 2021 06:15:28 -0300
Subject: [PATCH 7/8] Filter the links after the index section
---
build/validate_links.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/build/validate_links.py b/build/validate_links.py
index eb5dfa30..389de8cc 100755
--- a/build/validate_links.py
+++ b/build/validate_links.py
@@ -14,12 +14,19 @@ ignored_links = [
def parse_links(filename):
"""Returns a list of URLs from text file"""
- with open(filename) as fp:
- data = fp.read()
+ with open(filename, mode='r', encoding='utf-8') as fp:
+ readme = fp.read()
+ index_section = readme.find('## Index')
+ content = readme[index_section:]
+
raw_links = re.findall(
'((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'\".,<>?«»“”‘’]))',
- data)
- links = [raw_link[0] for raw_link in raw_links]
+ content)
+
+ links = [
+ str(raw_link[0]).rstrip('/') for raw_link in raw_links
+ ]
+
return links
def dup_links(links):
@@ -30,7 +37,6 @@ def dup_links(links):
dupes = []
for link in links:
- link = link.rstrip('/')
if link in ignored_links:
continue
From 48946082bad7ad78675fdfbd6460fd2238bcb87e Mon Sep 17 00:00:00 2001
From: Matheus Felipe <50463866+matheusfelipeog@users.noreply.github.com>
Date: Tue, 24 Aug 2021 06:21:23 -0300
Subject: [PATCH 8/8] Remove unnecessary verification
---
build/validate_links.py | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/build/validate_links.py b/build/validate_links.py
index 389de8cc..9bb4405b 100755
--- a/build/validate_links.py
+++ b/build/validate_links.py
@@ -5,12 +5,6 @@ import re
import socket
import sys
-ignored_links = [
- 'https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Run+tests%22',
- 'https://github.com/public-apis/public-apis/workflows/Validate%20links/badge.svg?branch=master',
- 'https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Validate+links%22',
- 'https://github.com/davemachado/public-api',
-]
def parse_links(filename):
"""Returns a list of URLs from text file"""
@@ -37,9 +31,6 @@ def dup_links(links):
dupes = []
for link in links:
- if link in ignored_links:
- continue
-
if link not in seen:
seen[link] = 1
else: