
from html2text import html2text

sourceHTML = '''
<tr>
<td><code>:ok_hand:</code></td>
<td>&#x1F44C;</td>
</tr>
<tr>
<td><code>:+1</code></td>
<td>&#x1F44D;</td>
</tr>
<tr>
<td><code>:-1:</code></td>
<td>&#x1F44E;</td>
</tr>
<tr>
<td><code>:100:</code></td>
<td>&#x1F4AF;</td>
</tr>
<tr>
<td><code>:point_right:</code></td>
<td>&#x1F449;</td>
</tr>
<tr>
<td><code>:point_left:</code></td>
<td>&#x1F448;</td>
</tr>
<tr>
<td><code>:clock5:</code></td>
<td>&#x1F554;</td>
</tr>
<tr>
<td><code>:calendar:</code></td>
<td>&#x1F4C6;</td>
</tr>
<tr>
<td><code>:punch:</code></td>
<td>&#x1F44A;</td>
</tr>
<tr>
<td><code>:v:</code></td>
<td>&#x270C;&#xFE0F;</td>
</tr>
<tr>
<td><code>:hand:</code></td>
<td>&#x270B;</td>
</tr>
<tr>
<td><code>:clap:</code></td>
<td>&#x1F44F;</td>
</tr>
<tr>
<td><code>:muscle:</code></td>
<td>&#x1F4AA;</td>
</tr>
<tr>
<td><code>:pray:</code></td>
<td>&#x1F64F;</td>
</tr>
<tr>
<td><code>:runner:</code></td>
<td>&#x1F3C3;</td>
</tr>
<tr>
<td><code>:metal:</code></td>
<td>&#x1F918;</td>
</tr>
<tr>
<td><code>:couple:</code></td>
<td>&#x1F46B;</td>
</tr>
<tr>
<td><code>:dancer:</code></td>
<td>&#x1F483;</td>
</tr>
<tr>
<td><code>:bow:</code></td>
<td>&#x1F647;</td>
</tr>
<tr>
<td><code>:ear:</code></td>
<td>&#x1F442;</td>
</tr>
<tr>
<td><code>:eyes:</code></td>
<td>&#x1F440;</td>
</tr>
<tr>
<td><code>:kiss:</code></td>
<td>&#x1F48B;</td>
</tr>
<tr>
<td><code>:sunny:</code></td>
<td>&#x2600;&#xFE0F;</td>
</tr>
<tr>
<td><code>:zap:</code></td>
<td>&#x26A1;&#xFE0F;</td>
</tr>
<tr>
<td><code>:cat:</code></td>
<td>&#x1F431;</td>
</tr>
<tr>
<td><code>:dog:</code></td>
<td>&#x1F436;</td>
</tr>
<tr>
<td><code>:pig:</code></td>
<td>&#x1F437;</td>
</tr>
<tr>
<td><code>:frog:</code></td>
<td>&#x1F438;</td>
</tr>
<tr>
<td><code>:bear:</code></td>
<td>&#x1F43B;</td>
</tr>
<tr>
<td><code>:rat:</code></td>
<td>&#x1F400;</td>
</tr>
<tr>
<td><code>:earth_asia:</code></td>
<td>&#x1F30F;</td>
</tr>
<tr>
<td><code>:gift:</code></td>
<td>&#x1F381;</td>
</tr>
<tr>
<td><code>:computer:</code></td>
<td>&#x1F4BB;</td>
</tr>
<tr>
<td><code>:telephone:</code></td>
<td>&#x260E;&#xFE0F;</td>
</tr>
<tr>
<td><code>:sound:</code></td>
<td>&#x1F509;</td>
</tr>
<tr>
<td><code>:email:</code></td>
<td>&#x2709;&#xFE0F;</td>
</tr>
<tr>
<td><code>:key:</code></td>
<td>&#x1F511;</td>
</tr>
<tr>
<td><code>:date:</code></td>
<td>&#x1F4C5;</td>
</tr>
<tr>
<td><code>:gun:</code></td>
<td>&#x1F52B;</td>
</tr>
<tr>
<td><code>:bomb:</code></td>
<td>&#x1F4A3;</td>
</tr>
<tr>
<td><code>:sos:</code></td>
<td>&#x1F198;</td>
</tr>
<tr>
<td><code>:accept:</code></td>
<td>&#x1F251;</td>
</tr>
<tr>
<td><code>:secret:</code></td>
<td>&#x3299;&#xFE0F;</td>
</tr>
<tr>
<td><code>:congratulations:</code></td>
<td>&#x3297;&#xFE0F;</td>
</tr>
'''

sourceMD = html2text(sourceHTML)

for line in sourceMD.split('\n'):
    if '|' in line:
        mdCode, emojiCode = line.split('|')
        listDEC = emojiCode.strip().encode(encoding='unicode-escape').decode().upper().lstrip('\\').split('\\')
        htmlCode = ''.join(map(lambda x: '&#x{};'.format(x.lstrip('U').lstrip('0').strip()), listDEC))
        md = '{}|`{}`|{}|{}'.format(mdCode.strip(), htmlCode, mdCode.strip().strip('`'),emojiCode.strip())
        print(md)
