Html Agility Pack парсинг страницы - C#
Формулировка задачи:
Народ, есть код
Помогите пожалуйста выцепить значения
из
точнее http://cs12593.userapi.com/ , 6592610 , f1fd80093b
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" id="vkontakte"><head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="content-type" content="text/html; charset=windows-1251"> <style type="text/css"> html { height: 100%; overflow: hidden; } body { margin:0; padding:0; background:#F7F7F7; height: 100%; } </style> <style type="text/css"> .ad_box_new, #banner1, #banner2, #left_ads, #ad_box_ad_0 { display: none ! important; }</style></head> <body> <script type="text/javascript">if (!window.vk) window.vk = {loginscheme: 'https', ip_h: '4bd9b5a873102e68b4'};</script> <script src="http://vk.com/js/common.js" type="text/javascript"></script> <script src="http://vk.com/js/lib/swfobject2.js" type="text/javascript"></script> <div id="flash_player_container_outer" style="width: 100%; height: 100%; display: none;"> <div id="flash_player_back" style="position:absolute;z-index:1;text-align:center;background-color:black;width:100%;height:100%"><img id="player_thumb" src="http://cs12593.userapi.com/u6592610/video/l_41d777b7.jpg" style="height: 100%; margin-top: 0px;"></div> <div id="flash_player_container" style="position:relative;z-index:2;text-align:center;width:100%;height:100%;margin:auto;"> <div id="video_player" style="width:100%;height:100%;overflow:hidden"> <div id="no_flash_info" style="font-family: Tahoma; font-size: 11px; margin: auto; width: 320px; padding: 10px; background-color: rgb(255, 255, 255); border: 1px solid rgb(204, 204, 204); position: relative; z-index: 5; top: 333.5px; background-position: initial initial; background-repeat: initial initial;"> <div>Для просмотра необходим <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW">Flash Player</a> последней версии.</div> <div id="player_html5_msg" style="display:block"> <div>(Flash-проигрыватель обладает более широкой функциональностью).</div> <div><br><a href="javascript:loadHtml5Player();">Открыть HTML5 видео проигрыватель.</a></div> </div> </div> </div> </div> </div> <div id="savefrom__vk_video_links" class="savefrom_vk_download" style="background-color: rgb(0, 0, 0); border: 0px; display: block; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: normal; position: absolute; top: 25px; left: 0px; right: 0px; margin: 0px; padding: 0px; z-index: 99990; background-position: initial initial; background-repeat: initial initial;"></div><div id="playerWrap" style="height: 100%;"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="playerObj" style="display: block;" width="100%" height="100%"> <param name="movie" value="http://vk.com/swf/VideoPlayer4_0.swf?42"> <param name="allowFullScreen" value="true"> <param name="allowscriptaccess" value="always"> <param name="flashvars" value="uid=6592610&vid=163847751&oid=-43375313&host=http://cs12593.userapi.com/&vtag=f1fd80093b&ltag=l_41d777b7&vkid=153188108&md_title=%D0%9E%D0%B1%D0%BC%D0%B0%D0%BD%D0%B8+%D0%BC%D0%B5%D0%BD%D1%8F+%281-12%29&md_author=%D0%9A%D0%BE%D0%BD%D1%81%D1%82%D0%B0%D0%BD%D1%82%D0%B8%D0%BD+%D0%A7%D0%B5%D1%80%D0%BD%D0%B5%D1%86%D0%BA%D0%B8%D0%B9&hd=3&no_flv=1&hd_def=-1&dbg_on=0&t=&thumb=http://cs12593.userapi.com/u6592610/video/l_41d777b7.jpg&hash=0bac2e709637341acfc926092e66eb23&hash2=0a0cea66f6eb1725&ip_subm=1&is_vk=1&is_ext=1&lang_add=%D0%94%D0%BE%D0%B1%D0%B0%D0%B2%D0%B8%D1%82%D1%8C+%D0%BA+%D1%81%D0%B5%D0%B1%D0%B5&lang_share=%D0%A0%D0%B0%D1%81%D1%81%D0%BA%D0%B0%D0%B7%D0%B0%D1%82%D1%8C+%D0%B4%D1%80%D1%83%D0%B7%D1%8C%D1%8F%D0%BC&lang_like=%D0%9C%D0%BD%D0%B5+%D0%BD%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%81%D1%8F&lang_volume_on=%D0%92%D0%BA%D0%BB%D1%8E%D1%87%D0%B8%D1%82%D1%8C+%D0%B7%D0%B2%D1%83%D0%BA&lang_volume_off=%D0%A3%D0%B1%D1%80%D0%B0%D1%82%D1%8C+%D0%B7%D0%B2%D1%83%D0%BA&lang_volume=%D0%93%D1%80%D0%BE%D0%BC%D0%BA%D0%BE%D1%81%D1%82%D1%8C&lang_hdsd=%D0%A1%D0%BC%D0%B5%D0%BD%D0%B8%D1%82%D1%8C+%D0%BA%D0%B0%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%BE&lang_fullscreen=%D0%9D%D0%B0+%D0%B2%D0%B5%D1%81%D1%8C+%D1%8D%D0%BA%D1%80%D0%B0%D0%BD&lang_window=%D0%A1%D0%B2%D0%B5%D1%80%D0%BD%D1%83%D1%82%D1%8C&lang_rotate=%D0%9F%D0%BE%D0%B2%D0%B5%D1%80%D0%BD%D1%83%D1%82%D1%8C&video_play_hd=%D0%A1%D0%BC%D0%BE%D1%82%D1%80%D0%B5%D1%82%D1%8C+%D0%B2+%D0%B2%D1%8B%D1%81%D0%BE%D0%BA%D0%BE%D0%BC+%D0%BA%D0%B0%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%B5&video_stop_loading=%D0%9E%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D1%82%D1%8C+%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D1%83&video_player_version=%D0%92%D0%9A%D0%BE%D0%BD%D1%82%D0%B0%D0%BA%D1%82%D0%B5+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE+%D0%BF%D0%BB%D0%B5%D0%B5%D1%80+&video_player_author=%D0%90%D0%B2%D1%82%D0%BE%D1%80+%D0%BF%D0%BB%D0%B5%D0%B5%D1%80%D0%B0+-+%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B5%D0%B9+%D0%A5%D0%B0%D1%80%D1%8C%D0%BA%D0%BE%D0%B2&goto_orig_video=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8+%D0%BA+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D0%B8&video_get_video_code=%D0%9A%D0%BE%D0%BF%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%D0%BA%D0%BE%D0%B4+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE&video_load_error=%D0%92%D0%B8%D0%B4%D0%B5%D0%BE%D1%84%D0%B0%D0%B9%D0%BB+%D0%B5%D1%89%D0%B5+%D0%BD%D0%B5+%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%B8%D0%BB%D1%81%D1%8F+%D0%B8%D0%BB%D0%B8+%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80+%D1%81+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%D1%84%D0%B0%D0%B9%D0%BB%D0%BE%D0%BC+%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%BD%D0%BE+%D0%BD%D0%B5%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B5%D0%BD&video_get_current_url=%D0%9A%D0%BE%D0%BF%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D1%83+%D0%BD%D0%B0+%D0%BA%D0%B0%D0%B4%D1%80"> <param name="wmode" value="opaque"> <embed id="flash_video_obj" src="http://vk.com/swf/VideoPlayer4_0.swf?42" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="100%" height="100%" wmode="opaque" flashvars="uid=6592610&vid=163847751&oid=-43375313&host=http://cs12593.userapi.com/&vtag=f1fd80093b&ltag=l_41d777b7&vkid=153188108&md_title=%D0%9E%D0%B1%D0%BC%D0%B0%D0%BD%D0%B8+%D0%BC%D0%B5%D0%BD%D1%8F+%281-12%29&md_author=%D0%9A%D0%BE%D0%BD%D1%81%D1%82%D0%B0%D0%BD%D1%82%D0%B8%D0%BD+%D0%A7%D0%B5%D1%80%D0%BD%D0%B5%D1%86%D0%BA%D0%B8%D0%B9&hd=3&no_flv=1&hd_def=-1&dbg_on=0&t=&thumb=http://cs12593.userapi.com/u6592610/video/l_41d777b7.jpg&hash=0bac2e709637341acfc926092e66eb23&hash2=0a0cea66f6eb1725&ip_subm=1&is_vk=1&is_ext=1&lang_add=%D0%94%D0%BE%D0%B1%D0%B0%D0%B2%D0%B8%D1%82%D1%8C+%D0%BA+%D1%81%D0%B5%D0%B1%D0%B5&lang_share=%D0%A0%D0%B0%D1%81%D1%81%D0%BA%D0%B0%D0%B7%D0%B0%D1%82%D1%8C+%D0%B4%D1%80%D1%83%D0%B7%D1%8C%D1%8F%D0%BC&lang_like=%D0%9C%D0%BD%D0%B5+%D0%BD%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%81%D1%8F&lang_volume_on=%D0%92%D0%BA%D0%BB%D1%8E%D1%87%D0%B8%D1%82%D1%8C+%D0%B7%D0%B2%D1%83%D0%BA&lang_volume_off=%D0%A3%D0%B1%D1%80%D0%B0%D1%82%D1%8C+%D0%B7%D0%B2%D1%83%D0%BA&lang_volume=%D0%93%D1%80%D0%BE%D0%BC%D0%BA%D0%BE%D1%81%D1%82%D1%8C&lang_hdsd=%D0%A1%D0%BC%D0%B5%D0%BD%D0%B8%D1%82%D1%8C+%D0%BA%D0%B0%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%BE&lang_fullscreen=%D0%9D%D0%B0+%D0%B2%D0%B5%D1%81%D1%8C+%D1%8D%D0%BA%D1%80%D0%B0%D0%BD&lang_window=%D0%A1%D0%B2%D0%B5%D1%80%D0%BD%D1%83%D1%82%D1%8C&lang_rotate=%D0%9F%D0%BE%D0%B2%D0%B5%D1%80%D0%BD%D1%83%D1%82%D1%8C&video_play_hd=%D0%A1%D0%BC%D0%BE%D1%82%D1%80%D0%B5%D1%82%D1%8C+%D0%B2+%D0%B2%D1%8B%D1%81%D0%BE%D0%BA%D0%BE%D0%BC+%D0%BA%D0%B0%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%B5&video_stop_loading=%D0%9E%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%B8%D1%82%D1%8C+%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D1%83&video_player_version=%D0%92%D0%9A%D0%BE%D0%BD%D1%82%D0%B0%D0%BA%D1%82%D0%B5+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE+%D0%BF%D0%BB%D0%B5%D0%B5%D1%80+&video_player_author=%D0%90%D0%B2%D1%82%D0%BE%D1%80+%D0%BF%D0%BB%D0%B5%D0%B5%D1%80%D0%B0+-+%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B5%D0%B9+%D0%A5%D0%B0%D1%80%D1%8C%D0%BA%D0%BE%D0%B2&goto_orig_video=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8+%D0%BA+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D0%B8&video_get_video_code=%D0%9A%D0%BE%D0%BF%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%D0%BA%D0%BE%D0%B4+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE&video_load_error=%D0%92%D0%B8%D0%B4%D0%B5%D0%BE%D1%84%D0%B0%D0%B9%D0%BB+%D0%B5%D1%89%D0%B5+%D0%BD%D0%B5+%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%B8%D0%BB%D1%81%D1%8F+%D0%B8%D0%BB%D0%B8+%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80+%D1%81+%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%D1%84%D0%B0%D0%B9%D0%BB%D0%BE%D0%BC+%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%BD%D0%BE+%D0%BD%D0%B5%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%B5%D0%BD&video_get_current_url=%D0%9A%D0%BE%D0%BF%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D1%83+%D0%BD%D0%B0+%D0%BA%D0%B0%D0%B4%D1%80"> </object> <div id="undefined" class="savefrom_vk_download" style="background-color: rgb(0, 0, 0); border: 1px solid rgb(255, 255, 255); display: block; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: normal; position: absolute; top: 2px; right: 2px; padding: 3px 5px; margin: 0px; z-index: 99999; background-position: initial initial; background-repeat: initial initial;"><a href="#" style="color: rgb(255, 255, 255); text-decoration: initial;">Скачать</a></div></div> <script type="text/javascript"> var video_host = 'http://cs12593.userapi.com/'; var video_uid = '6592610'; var video_vtag = 'f1fd80093b'; var video_no_flv = 1; var video_max_hd = '3'; var video_title = '%D0%9E%D0%B1%D0%BC%D0%B0%D0%BD%D0%B8+%D0%BC%D0%B5%D0%BD%D1%8F+%281-12%29'; var video_author = '%D0%9A%D0%BE%D0%BD%D1%81%D1%82%D0%B0%D0%BD%D1%82%D0%B8%D0%BD+%D0%A7%D0%B5%D1%80%D0%BD%D0%B5%D1%86%D0%BA%D0%B8%D0%B9'; var fixed_player_size = false; var playerCallback = { scoreCardCounter: function () { // vkImage().src = vk.loginscheme + '://b.scorecardresearch.com/p?c1=1&c2=13765216&c5=06&rn=' + Math.round(Math.random() * 1000000000); }, onVideoPlayProgress: function(oid, vid, hash, time_progress, time_total) { var rawId = oid+'_'+vid; if (time_progress < 5000 && window.tnsStart != rawId) { playerCallback.scoreCardCounter(); window.tnsStart = rawId; } else if (time_progress > (time_total / 2) && window.tnsEnd != rawId) { window.tnsEnd = rawId; } } } function videoCallback(params) { var method = params.shift(); if (playerCallback[method]) { playerCallback[method].apply(null, params); } } function loadHtml5Player() { addCss('css/video_html5.css'); attachScript('html5_js', '/js/video_html5.js?6'); ge('player_thumb').style.display = 'none'; onResize(null); } (function(){ onDomReady(function(){ if(swfobject.hasFlashPlayerVersion('9')) { ge('flash_player_container_outer').style.display = 'none'; var p = ge('playerObj'); if (p) p.style.display = 'block'; } else { //onResize(null); } }); })(); addEvent(ge('player_thumb'), 'load', onLoad); var thumb_ratio = 1; var thumb_height = 0; function onLoad(e) { var thumbSz = getSize(ge('player_thumb')); thumb_ratio = thumbSz[0] / thumbSz[1]; thumb_height = thumbSz[1]; onResize(null); } addEvent(window, 'resize', onResize); function onResize(e) { var popup = ge('no_flash_info'); var popupSz = getSize(popup); var thumb = ge('player_thumb'); var backSz = getSize(ge('flash_player_container_outer')); var hh = backSz[1] + "px"; var p1 = ge('html5-player'); if (p1) { setStyle(p1, {width:'100%',height:hh}); setStyle(ge('bg'), {width:'100%',height:hh}); centerPopup(); calcPrLineW(); } var p2 = ge('flash_video_obj'); if (p2) { //p2.style.height = hh; } if (backSz[0] / backSz[1] < thumb_ratio) { setStyle(thumb, {width:'100%',height:''}); var thumbSz = getSize(thumb); thumb.style.marginTop = ((backSz[1] - thumbSz[1]) / 2) + 'px'; } else { setStyle(thumb, {width:'',height:'100%',marginTop:0}); } popup.style.top = ((backSz[1] - popupSz[1]) / 2) + 'px'; } </script> </body><style type="text/css"></style></html>
<script type="text/javascript"> var video_host = 'http://cs12593.userapi.com/'; var video_uid = '6592610'; var video_vtag = 'f1fd80093b';
Ребят, помогите
Решение задачи: «Html Agility Pack парсинг страницы»
textual
Листинг программы
StreamReader str = new StreamReader("video.html", Encoding.Default); while (!str.EndOfStream) { st = str.ReadLine(); if (st.StartsWith("var video_host = ")) { string rk = "var video_host = '"; int a = rk.Length; st = st.Remove(0, a); int n = st.Length; st = st.Remove(n - 2); break;// останавливаем цикл } }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д