Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, re
- text = requests.get('https://en.wikisource.org/wiki/Strong%27s_Exhaustive_Concordance/H0?action=raw').text
- HEAD = re.compile(r"==([0-9]+)==\n'''NONE", re.MULTILINE)
- LINK = re.compile(r'#([0-9]+)\|NONE')
- headers = {'User-Agent': 'Mozilla/5.0'}
- cache = {}
- def get_word(num):
- if num in cache: return cache[num]
- text = requests.get(f'https://kingjamesbibledictionary.com/StrongsNo/H{num}', headers=headers).text
- cache[num] = text.split('<td class="Hebrew">')[1].split('</td>')[0]
- return cache[num]
- def sub(match):
- return match[0].replace('NONE', get_word(int(match[1])))
- text = re.sub(HEAD, sub, text)
- text = re.sub(LINK, sub, text)
- print(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement