SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
真・ドルヲタを支える技術
    @nipotan
アツい夏、TIF の夏

• TOKYO IDOL FESTIVAL
• http://www.idolfes.com/
 •   TOKYO IDOL FESTIVAL(トウキョウ・アイドル・フェスティバ
     ル)は、2010年より開催されている日本のアイドルイベントであ
     る。略称はTIF(ティフ)。女性アイドルグループを中心に50組以
     上の女性アイドルが参加する。参加アイドルの数では日本最大規
     模のアイドルイベントである。 (出典: Wikipedia)
TIF 2012

• 8/4, 8/5 の二日間
• 10 ステージ、111 組 732 名のアイドル
 (土曜は 9 ステージ)

• 2012 年の目玉は SKE48
お気に入り

• お気に入りのアイドルを見たい!
• タイムテーブルを見よう
 • http://www.idolfes.com/2012/timetable/
WTF


• 画像かよ!!
否


• iPhone, Androidで見ると
 • http://www.idolfes.com/2012/sp/
タイムテーブル


• もっと検索しやすく
 • やっぱ iCal
iCal 系 CPAN モジュール



• http://search.cpan.org/search?
  query=ical&mode=all
iCal 形式

• テキストベースだから何となくわかるね
• 適当なイベントを作って、iCal で export
 してみよう
形式
• iCal の形式
   BEGIN:VCALENDAR
   METHOD:PUBLISH
   VERSION:2.0
   X-WR-TIMEZONE:Asia/Tokyo
   X-WR-CALNAME:カレンダー名
   X-WR-CALDESC:説明
     (イベントデータ)
   END:VCALENDAR
形式
• イベント
         BEGIN:VEVENT
            :
            :
         END:VEVENT
形式
• イベントの見てもよくわからんデータ
    UID:ランダム文字列
    SEQUENCE:0
    STATUS:CONFIRMED
    TRANSP:OPAQUE
形式
 • イベントの見りゃわかるデータ
DTSTART:開始日時 (%Y%m%dT%H%M%SZ)
DTEND:終了日時 (%Y%m%dT%H%M%SZ)
SUMMARY:イベントのタイトル
LOCATION:場所
DESCRIPTION:説明
Let’s Scrape
use strict;
use warnings;
use Web::Scraper;

my $tif = scraper {
    process 'section', 'event[]' => scraper {
        process 'time', 'time' => 'TEXT';
        process 'div > h4', 'title' => 'TEXT';
        process 'div > p', 'performer' => [
            'HTML', sub { s{<brs*/>s*}{n}g },
        ];
    };
};
URL
• $date は 0804 か 0805
• $stage は hot とか green とか doll とか
my $url = "http://www.idolfes.com/2012/sp/time${date}_${stage}.html";
ステージ名
• ちゃんと正式名称がある
 • 場所に使える
my %stages = (
    hot        =>   'HOT STAGE',
    green      =>   'GREEN OASYS',
    doll       =>   'DOLL FACTORY',
    fantastic =>    'FANTASTIC THEATER',
    wonder     =>   'WONDER FUTURE PLANET',
    smile      =>   'SMILE GARDEN',
    sky        =>   'SKY STAGE',
    secret     =>   'SECRET COURT',
    fresh      =>   'FRESH FIELD',
    welcome    =>   'WELCOME MARQUEE',
    greeting =>     'GREETING SQUARE',
);
greeting
• 自由すぎる
 • http://www.idolfes.com/2012/sp/
    time0804_greeting.html
ステージ名
• greeting はパス…
my %stages = (
    hot        => 'HOT STAGE',
    green      => 'GREEN OASYS',
    doll       => 'DOLL FACTORY',
    fantastic => 'FANTASTIC THEATER',
    wonder     => 'WONDER FUTURE PLANET',
    smile      => 'SMILE GARDEN',
    sky        => 'SKY STAGE',
    secret     => 'SECRET COURT',
    fresh      => 'FRESH FIELD',
    welcome    => 'WELCOME MARQUEE',
#    greeting => 'GREETING SQUARE',
);
開始時刻と終了時刻
• そもそも iCal の日時は UTC
 • DateTime でちゃんと取り扱おう
開始時刻と終了時刻
• 時刻の形式
 • HH:MM∼HH:MM
my($from_time, $to_time) = split /x{ff5e}/, $event->{time};
開始時刻と終了時刻
• 罠その 1
 • 8/4 の HOT STAGE
 • http://www.idolfes.com/2012/sp/
    time0804_hot.html
開始時刻と終了時刻
• 罠その 2
 • 8/4 の FANTASTIC THEATER ほか
 • http://www.idolfes.com/2012/sp/
      time0804_fantastic.html
% perl -MDateTime -e'DateTime->new(hour => 24)'
The 'hour' parameter ("24") to DateTime::new did not pass the 'an
integer between 0 and 23' callback
開始時刻と終了時刻
• 罠その 3
 • 8/4 WELCOME MARQUEE 9:45∼10:00
 • http://www.idolfes.com/2012/sp/
   time0804_welcome.html
   • 通常 vs ここだけ
開始時刻と終了時刻
• 時刻の形式
 • HH:MM∼HH:MM
my($from_time, $to_time)
    = split /[x{ff5e}x{301c}]/, $event->{time};
出演ユニット
• イベントタイトルと出演者が別の場合
 • performer に
iCal のデータ形式
• 75 文字で改行させないといけない
 • 続く次の行は空白かタブではじまる
•  は  に
• 改行は n に
• , は , に
iCal で安全な形式
sub ical_safe {
    my $str = shift;
    $str =~ s///g;
    $str =~ s/n/n/g;
    $str =~ s/,/,/g;
    my @rounded = ();
    while ($str =~ s/^(.{1,75})//) {
        push @rounded, $1;
    }
    return join("n ", @rounded);
}
最終的に


• https://gist.github.com/3282049
取り込んだ例


• DEMO
まとめ
• User-Agent を iPhone は意外に盲点
• Web::Scraper やっぱり便利
• 何事も CPAN に頼らない
• アイドル別のほうが高まれる
• http://www.amazon.co.jp/dp/B008OI71MK
糸冬了


• QUESTIONS?

Más contenido relacionado

Último

Último (10)

論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 

Destacado

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

真・ドルヲタを支える技術