Skip to content

Instantly share code, notes, and snippets.

@offby1
Last active September 11, 2016 04:09
Show Gist options
  • Save offby1/5b3c89a1bf26920a3cb02ab112e9c5f9 to your computer and use it in GitHub Desktop.
Save offby1/5b3c89a1bf26920a3cb02ab112e9c5f9 to your computer and use it in GitHub Desktop.
from bs4 import BeautifulSoup
import requests
import re
import urlparse
html = requests.get("http://mandalorianmercs.org/forum/index.php?board=86.0")
html.encoding = 'ISO-8859-1'
soup = BeautifulSoup(html.text, 'html.parser')
for link in soup.find_all('a', href=re.compile('.*index.php\\?topic=')):
href = link.get('href')
parsed = urlparse.urlparse(href)
if not parsed.fragment:
print(href, link.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment