I found a guy’s project on GitHub where he already built the tool for checking backlinks. To use this tool, you need to provide a text file that contains the referring domain and the destination URL. They need to be side by side in their own row. Each referring domain is scraped and searched.
urltocheck.com,yoururl.com
urltocheck2.de,yoururl.de

The full source can be found on the GitHub page linked above, or just see it below. Here is what it does:
- Set up credentials for web browsing
- Create an empty list to store URLs
- Pull URLs from text file
- Split the comma separated URLs for each row in the document
- Visit the referring domain’s web page
- Parse the HTML and scan it for any mention of the destination URL
- Return true or false
import requests
import time
headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36'}
print("---initialize")
not_found = []
to_check = open('urls.txt', 'r+')
for check in to_check.read().splitlines():
do_check = check.split(',')
print("---checking ", do_check[0])
r = requests.get(do_check[0], headers=headers)
if do_check[1] in r.text:
print("---ok")
else:
not_found.append(do_check[0])
print("---", do_check[1], " not found on ", do_check[0])
time.sleep(1)
print(len(not_found), " Link not found")
print("\n",not_found)