?php
//抓取抖音的接口數據
global $nCov_data;
$nCov_data['data']=get_nCoV_douyin_news();
$nCov_data['total']=get_nCoV_douyin_total();
function get_nCoV_douyin_news(){
$content=@file_get_contents('https://i.snssdk.com/api/feed/forum_flow/v1/?forum_id=1656388947394568is_web_refresh=1channel=local_testquery_id=1656388947394568tab_id=1656388947394584is_preview=1stream_api_version=82aid=13forum_id=1656388947394568is_preview=0');
$c=count(json_decode($content)->data)-1;
$getInfos=@json_decode(json_decode($content)->data[$c]->content)->sub_raw_datas;
if ($getInfos){
foreach ($getInfos as $k=>$Info){
$data[$k]=[
'showtime'=>$Info->raw_data->showtime_string,//展示時間
'desc'=>$Info->raw_data->desc,//簡訊
'event_time'=>$Info->raw_data->event_time//真實播報時間
];
}
return $data;
}else{
return false;
}
}
function get_nCoV_douyin_total(){
$content=@file_get_contents('https://i.snssdk.com/forum/home/v1/info/?forum_id=1656388947394568is_web_refresh=1');
$getInfos=@json_decode(json_decode($content)->forum->extra->ncov_string_list);
$data['desc']=@json_decode($content)->forum->rich_content;
$data['img']=@json_decode($content)->forum->extra->ncov_image_url;
if ($getInfos){
foreach ($getInfos as $k=>$Info){
$data['provinces'][$k]=$Info;
}
return $data;
}else{
return false;
}
}
?>
!doctype html>
html lang="zh">
head>
meta charset="UTF-8">
meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
meta http-equiv="X-UA-Compatible" content="ie=edge">
meta author="__Mark_Cheng__QQ72817">
link rel="stylesheet" href="CSS/index.css" rel="external nofollow" >
title>實時更新:新型冠狀病毒肺炎疫情/title>
/head>
body>
div class="view">
div class="header">
div class="title">新型冠狀病毒肺炎/div>
div class="to-title">疫情通報/div>
/div>
div class="show">
div class="total">
p class="title">span>實時疫情狀況/span>span>數據抓取時間:?php echo date('Y.m.d H:i');?>/span>/p>
p class="desc">?php echo $nCov_data['total']['desc'];?>/p>
/div>
div class="map">
img src="?php echo $nCov_data['total']['img'];?>" alt="實時地圖" width="100%">
/div>
div class="list">
ul>
?php
foreach ($nCov_data['total']['provinces'] as $key=>$val){
echo 'li>span>'.$val.'/span>/li>';
}
?>
/ul>
/div>
div class="timeline">
div class="title">疫情追蹤/div>
div class="c">
?php
foreach ($nCov_data['data'] as $key=>$val){
?>
div class="content">
div class="i">/div>
div class="c">
div class="show_time">
?php echo date('m月d日 H:i',$val['event_time']);?>
/div>
div class="desc">
?php echo $val['desc'];?>
/div>
/div>
/div>
?php
}
?>
/div>
/div>
div class="tip">
img src="https://mat1.gtimg.com/news/images/inews/2020/feiyan/18/img/prevent.png" alt="溫馨提示" width="100%">
/div>
/div>
/div>
/body>
/html>