Advertisement
Guest User

Untitled

a guest
May 13th, 2022
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import requests, re
  2.  
  3. text = requests.get('https://en.wikisource.org/wiki/Strong%27s_Exhaustive_Concordance/H0?action=raw').text
  4. HEAD = re.compile(r"==([0-9]+)==\n'''NONE", re.MULTILINE)
  5. LINK = re.compile(r'#([0-9]+)\|NONE')
  6. headers = {'User-Agent': 'Mozilla/5.0'}
  7. cache = {}
  8.  
  9. def get_word(num):
  10.   if num in cache: return cache[num]
  11.   text = requests.get(f'https://kingjamesbibledictionary.com/StrongsNo/H{num}', headers=headers).text
  12.   cache[num] = text.split('<td class="Hebrew">')[1].split('</td>')[0]
  13.   return cache[num]
  14.  
  15. def sub(match):
  16.   return match[0].replace('NONE', get_word(int(match[1])))
  17.  
  18. text = re.sub(HEAD, sub, text)
  19. text = re.sub(LINK, sub, text)
  20. print(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement