Skip to content

Instantly share code, notes, and snippets.

@EncodeTheCode
Created March 4, 2018 15:36
Show Gist options
  • Select an option

  • Save EncodeTheCode/1f73ebdd97191cc6935f467e6cfae7b5 to your computer and use it in GitHub Desktop.

Select an option

Save EncodeTheCode/1f73ebdd97191cc6935f467e6cfae7b5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import urllib2
import re
matcher = re.compile("displayId: ([0-9]+)")
def fetch_display_id (npc_id):
url = "https://www.wowhead.com/npc=%s" % npc_id
fs = urllib2.urlopen(url)
data = fs.read()
fs.close()
return matcher.findall(data)[0]
with open("model_ids.txt") as m:
model_input = m.readlines()
output = ""
for line in model_input:
m_id = line.strip()
m_display_id = fetch_display_id(m_id)
output = output + "%s=%s\n" % (m_id, m_display_id)
print "%s=%s" % (m_id, m_display_id)
with open("model_display_ids.txt", "w") as m:
m.write(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment