Last active
December 19, 2015 09:09
-
-
Save seikichi/5930875 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# http://futaba.qs.cjb.net/nijiran/fCatalog_MAY.html のタイトル取得が | |
# うまく出来んと言われたのでやってみた (なげやり) | |
# lxml は charset 適当に見つけたら上手いこと decode してくれるので | |
# response.text じゃなくて response.content を lxml.html.fromstring に | |
# 渡せばいいよとかそんな話 | |
import lxml.html | |
import requests | |
response = requests.get('http://futaba.qs.cjb.net/nijiran/fCatalog_MAY.html') | |
root = lxml.html.fromstring(response.content) | |
title = root.xpath('//title/text()')[0] | |
print(title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment