Last active
September 11, 2016 04:09
-
-
Save offby1/5b3c89a1bf26920a3cb02ab112e9c5f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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