Last active
April 7, 2016 05:48
-
-
Save CLCL/02e3be49482b85807dba191e460ef27b to your computer and use it in GitHub Desktop.
モリサワのフォント見本のページでよみかたが入ったが、どちらかというとJSONがほしいのである
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
{ | |
"require": { | |
"php": ">=5.3.3", | |
"fabpot/goutte": "~1.0" | |
} | |
} |
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
curl -sS https://getcomposer.org/installer | php | |
php composer.phar install |
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
<?php | |
require_once __DIR__ . '/vendor/autoload.php'; | |
ini_set('default_charset', 'UTF-8'); | |
define(USER_AGENT, 'Goutte/1.0.7'); | |
$client = new Goutte\Client; | |
$client->setHeader('User-Agent', USER_AGENT); | |
$crawler = $client->request('GET', 'http://www.morisawa.co.jp/fonts/specimen/1317'); | |
$fontname = preg_replace('/\s\|.*$/','', trim($crawler->filter('title')->text()) ); | |
$res = array( | |
fontname => $fontname, | |
kana => trim($crawler->filter('.kana dd' )->text()), | |
maker => trim($crawler->filter('.maker dd')->text()), | |
lang => trim($crawler->filter('.lang dd' )->text()), | |
); | |
echo json_encode($res); | |
exit(0); |
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
<!DOCTYPE html> | |
<html lang="ja" id="guide" class="pointer"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width,minimum-scale=1.0,initial-scale=1"> | |
<meta name="format-detection" content="telephone=no"> | |
<link rel="shortcut icon" href="/favicon.ico"> | |
<link rel="apple-touch-icon" href="/img/common/apple-touch-icon.png"> | |
<title>リュウミン M-KL | 書体見本 | モリサワのフォント | 株式会社モリサワ</title> | |
<meta name="description" content="「リュウミン」は、その名の元となった森川龍文堂明朝体をベースに開発した、スタンダードな明朝体です。金属活字に由来する彫刻刀の冴えを、左右のハライや点の形に活かしながらも、縦画・横画の先端やウロコにはやわらかさをもたせており、親しみやすい雰囲気になっています。特に、均整のとれた流れるような表情の美しさには定評があり、本文組みから見出しまでDTPの基本書体として幅広く使用されています。"> | |
<meta property="og:title" content="リュウミン M-KL | 書体見本 | モリサワのフォント"> | |
<meta property="og:site_name" content="株式会社モリサワ"> | |
<meta property="og:description" content="「リュウミン」は、その名の元となった森川龍文堂明朝体をベースに開発した、スタンダードな明朝体です。金属活字に由来する彫刻刀の冴えを、左右のハライや点の形に活かしながらも、縦画・横画の先端やウロコにはやわらかさをもたせており、親しみやすい雰囲気になっています。特に、均整のとれた流れるような表情の美しさには定評があり、本文組みから見出しまでDTPの基本書体として幅広く使用されています。"> | |
<meta property="og:url" content="http://www.morisawa.co.jp/fonts/specimen/1317"> | |
<meta property="og:image" content="http://morisawa-resources.s3.amazonaws.com/uploads/ung/font/sample_detail_image/476/ryumin-medium-kl_detail.png"> | |
<meta property="og:type" content="website"> | |
... | |
<div class="col-right col col-4"> | |
<dl class="kana"> | |
<dt class="font-medium">読み方</dt> | |
<dd>りゅうみん</dd> | |
</dl> | |
<dl class="maker"> | |
<dt class="font-medium">メーカ</dt> | |
<dd>モリサワ</dd> | |
</dl> | |
<dl class="lang"> | |
<dt class="font-medium">言語</dt> | |
<dd> | |
日本語</dd> | |
</dl> | |
... |
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
$ php morisawa-font-yomi-scrape.php | jq . | |
{ | |
"lang": "日本語", | |
"maker": "モリサワ", | |
"kana": "りゅうみん", | |
"fontname": "リュウミン M-KL" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment