2012-01-11 36 views
1

私は本質的にウェブページのコンテンツを探すPHP/jQueryスクレーパー機能を持っています。YouTube動画の自動再生をオフにする

1つの方法で動画が検索されます。 youtubeのビデオページをテストするとき、ビデオは掻き取られ、うまく表示されます。ソースコードは次のようになります。

<embed width="320" height="240" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" flashvars="account_playback_token=&amp;ptk=KrebsCOHO%252Buser&amp;enablecsi=1&amp;iv_close_button=0&amp;mpvid=AAS2NjXQtb70zY15&amp;fexp=912208%2C914092%2C906423%2C901604&amp;hl=en_GB&amp;autohide=2&amp;csi_page_type=watch5ad&amp;keywords=Company+of+Heroes%2CCompany+of+Heroes+2%2CCOH+2%2CCOH%2CCOHO%2CCompany+of+Heroes+Online%2CvCOH%2CCommander%2CDefensive+Doctrine%2CAirborne+Doctrine%2CInfantry+Doctrine%2CBlitzkrieg+Doctrine%2CTerror+Doctrine%2CArmor+Doctrine%2CGenHansKrebs%2CKrebsCOHO%2CCompany+of+Heroes+Replays%2CCompany+of+Heroes+Casts%2CCompany+of+Heroes+Brits%2CCompany+of+Heroes+British%2CPanzer+Elite%2CTales+of+Valor%2COpposing+Fronts%2CCOH+Strategy%2CCompany+of+Heroes+Cheats%2CCompany+of+Heroes+Hacks&amp;cr=GB&amp;cc3_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswfbin%2Fsubtitles3_module-vflNKUm_s.swf&amp;host_language=en&amp;iv3_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswfbin%2Fiv3_module-vflVIYXve.swf&amp;no_get_video_log=1&amp;fmt_list=46%2F1920x1080%2F99%2F0%2F0%2C45%2F1280x720%2F99%2F0%2F0%2C22%2F1280x720%2F9%2F0%2F115%2C44%2F854x480%2F99%2F0%2F0%2C35%2F854x480%2F9%2F0%2F115%2C43%2F640x360%2F99%2F0%2F0%2C34%2F640x360%2F9%2F0%2F115%2C18%2F640x360%2F9%2F0%2F115%2C5%2F320x240%2F7%2F0%2F0&amp;iv_storage_server=http%3A%2F%2Fwww.youtube.com%2Fannotations%2F&amp;targeting_video_doc_id=&amp;trueview=True&amp;theme=tlb&amp;ad_preroll=1&amp;tk=A6fmSiw2bPJ1To1EkQ_GEhN5IQb7NH3SA2Lr7AmnDtyq0YRIw5HQFw%3D%3D&amp;iv_load_policy=1&amp;cc_font=Arial+Unicode+MS%2C+arial%2C+verdana%2C+_sans&amp;watch_xlb=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fxlb%2Fwatch%2Fstrings-en_GB-vflXhsWkH.xlb&amp;ad_channel_code_instream=afv_instream%2CVertical_Instream_8%2CVertical_Instream_41%2CVertical_Instream_933%2CVidVert8%2CVidVert41%2CVidVert933%2CVertical_8%2CVertical_41%2CVertical_933%2Cafv_instream_gb%2Cyt_mpvid_AAS2NjXQtb70zY15%2Cyt_cid_1640983%2Civp%2Cytexp_912208.914092.906423.901604%2Cytps_default%2Cytel_detailpage&amp;sdetail=f%3Ag-u%2C&amp;cafe_experiment_id=&amp;timestamp=1326243854&amp;cc_asr=1&amp;ad_host=ca-host-pub-6901191551304350&amp;ad_eurl=http%3A%2F%2Fwww.youtube.com%2Fvideo%2F0LzC0V_6TfI&amp;showpopout=1&amp;url_encoded_fmt_stream_map=url%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v2.lscache4.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cratebypass%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526itag%253D46%2526ip%253D95.0.0.0%2526signature%253DBB3EA0AD473B59EC8EE739170DFC4252629C04F1.A698AF6CCB326B05C6F31A687CB5C47003607517%2526sver%253D3%2526ratebypass%253Dyes%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dhd1080%26fallback_host%3Dtc.v2.cache4.c.youtube.com%26type%3Dvideo%252Fwebm%253B%2Bcodecs%253D%2522vp8.0%252C%2Bvorbis%2522%26itag%3D46%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v22.lscache1.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cratebypass%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526itag%253D45%2526ip%253D95.0.0.0%2526signature%253D9CA9C6F49F04CB131E4D3B9CFD12846CFA9E0C20.20C107ED1D2902332117EE528BB48DCB8A24D7CB%2526sver%253D3%2526ratebypass%253Dyes%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dhd720%26fallback_host%3Dtc.v22.cache1.c.youtube.com%26type%3Dvideo%252Fwebm%253B%2Bcodecs%253D%2522vp8.0%252C%2Bvorbis%2522%26itag%3D45%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v1.lscache1.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cratebypass%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526itag%253D22%2526ip%253D95.0.0.0%2526signature%253DB20BCC27B8113F47F66278E4208FE39BD53963C2.053298B3B43263F014DE8F65BE964D3815CB7683%2526sver%253D3%2526ratebypass%253Dyes%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dhd720%26fallback_host%3Dtc.v1.cache1.c.youtube.com%26type%3Dvideo%252Fmp4%253B%2Bcodecs%253D%2522avc1.64001F%252C%2Bmp4a.40.2%2522%26itag%3D22%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v10.lscache8.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cratebypass%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526itag%253D44%2526ip%253D95.0.0.0%2526signature%253D716B089CA9DFDB211533C46127FF2183118B8113.881E822D36F6CF39699C3BFAE2AFCF97B4BB9586%2526sver%253D3%2526ratebypass%253Dyes%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dlarge%26fallback_host%3Dtc.v10.cache8.c.youtube.com%26type%3Dvideo%252Fwebm%253B%2Bcodecs%253D%2522vp8.0%252C%2Bvorbis%2522%26itag%3D44%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v14.lscache5.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Calgorithm%25252Cburst%25252Cfactor%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526algorithm%253Dthrottle-factor%2526itag%253D35%2526ip%253D95.0.0.0%2526burst%253D40%2526sver%253D3%2526signature%253D724A616F7861BC4BFF321FAC98F78FEF9F50183D.540D2E9D4E1772AE72CE68124A6BDCA3844E37FA%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526factor%253D1.25%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dlarge%26fallback_host%3Dtc.v14.cache5.c.youtube.com%26type%3Dvideo%252Fx-flv%26itag%3D35%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v9.lscache2.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cratebypass%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526itag%253D43%2526ip%253D95.0.0.0%2526signature%253D5690ED3BF298418A63A1FC3C88C958A68584195B.457E8F33852B796BECA5640EF06DC20DDE82154C%2526sver%253D3%2526ratebypass%253Dyes%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dmedium%26fallback_host%3Dtc.v9.cache2.c.youtube.com%26type%3Dvideo%252Fwebm%253B%2Bcodecs%253D%2522vp8.0%252C%2Bvorbis%2522%26itag%3D43%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v6.lscache4.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Calgorithm%25252Cburst%25252Cfactor%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526algorithm%253Dthrottle-factor%2526itag%253D34%2526ip%253D95.0.0.0%2526burst%253D40%2526sver%253D3%2526signature%253D893DB716EDFB212C142092E4CDBCC0411D5F739F.ABE5CCCB87A14F189EF7CC5B09E5E9155FA42A4C%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526factor%253D1.25%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dmedium%26fallback_host%3Dtc.v6.cache4.c.youtube.com%26type%3Dvideo%252Fx-flv%26itag%3D34%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v5.lscache4.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Cratebypass%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526itag%253D18%2526ip%253D95.0.0.0%2526signature%253D961584FFF0C062FAD18B1D50B608148227664DB6.0BE5C5579A29A79168BBFD3356A60CA015603F10%2526sver%253D3%2526ratebypass%253Dyes%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dmedium%26fallback_host%3Dtc.v5.cache4.c.youtube.com%26type%3Dvideo%252Fmp4%253B%2Bcodecs%253D%2522avc1.42001E%252C%2Bmp4a.40.2%2522%26itag%3D18%2Curl%3Dhttp%253A%252F%252Fo-o.preferred.lhr14s15.v21.lscache4.c.youtube.com%252Fvideoplayback%253Fsparams%253Did%25252Cexpire%25252Cip%25252Cipbits%25252Citag%25252Csource%25252Calgorithm%25252Cburst%25252Cfactor%25252Ccp%2526fexp%253D912208%25252C914092%25252C906423%25252C901604%2526algorithm%253Dthrottle-factor%2526itag%253D5%2526ip%253D95.0.0.0%2526burst%253D40%2526sver%253D3%2526signature%253DA9B71D32C230E1F299E367D90AFA645A5D5E80A0.7E100FAA814386C7560B9657AA6932F2D8983458%2526source%253Dyoutube%2526expire%253D1326268838%2526key%253Dyt1%2526ipbits%253D8%2526factor%253D1.25%2526cp%253DU0hRS1JRVl9IUkNOMV9KS1pJOnVjQzhtUzNZVjVv%2526id%253Dd0bcc2d15ffa4df2%26quality%3Dsmall%26fallback_host%3Dtc.v21.cache4.c.youtube.com%26type%3Dvideo%252Fx-flv%26itag%3D5&amp;tmi=1&amp;iv_logging_level=3&amp;ad_flags=0&amp;endscreen_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswfbin%2Fendscreen-vfl6o3XZn.swf&amp;cid=1640983&amp;referrer=None&amp;afv_instream_max=20000&amp;ad_logging_flag=1&amp;t=vjVQa1PpcFPtL2KNy9BlI1YWfqrxIuH0Q7IxA2lS4fY%3D&amp;sffb=True&amp;ttsurl=http%3A%2F%2Fwww.youtube.com%2Fapi%2Ftimedtext%3Fsparams%3Dasr_langs%252Ccaps%252Cexpire%252Cv%26asr_langs%3Den%252Cko%252Cja%26caps%3Dasr%26expire%3D1326268800%26key%3Dyttt1%26signature%3D08601E0AFAF4E565C284D451574665CE892A187A.C3A7BCC212D929F08BA9FB37BA1FA706CE8B408B%26hl%3Den-GB&amp;aftv=True&amp;creator=KrebsCOHO&amp;allow_embed=1&amp;ad_host_tier=2902314&amp;rvs=view_count%3D1%252C978%26author%3DKrebsCOHO%26length_seconds%3D2153%26id%3D51if2_4DyoY%26title%3DCompany%2Bof%2BHeroes%2B%252395%2B-%2BGuess%2BWho%2527s%2BBack%2Cview_count%3D1%252C287%26author%3DKrebsCOHO%26length_seconds%3D2128%26id%3DnpOGF24Xun0%26title%3DBattlefield%2B3%2B%25239%2B-%2BThe%2BAmazing%2BBack%2Bto%2BKarkand%2Cview_count%3D2%252C386%26author%3DKrebsCOHO%26length_seconds%3D2913%26id%3Dc91SxbW5RTI%26title%3D%255BCOH%255D%2B%252382%2B-%2BOne%2BMove%2Bto%2BChange%2Bit%2BAll%2Cview_count%3D1%252C337%26author%3Dfrewd100%26length_seconds%3D1555%26id%3DsgxLZTsoZEk%26title%3DCompany%2Bof%2BHeroes%2B3v3%2BOnline%2BBattle%2BRefinery%2B%25281%252F2%2529%2Cview_count%3D3%252C077%26author%3DKrebsCOHO%26length_seconds%3D3400%26id%3D5fHOapLYenQ%26title%3DCompany%2Bof%2BHeroes%2B%252397%2B-%2BEurope%2BIn%2BRuins%2BShowcase%2Cview_count%3D27%252C804%26author%3DEvolvSports%26length_seconds%3D351%26id%3DP4y5fdDZH60%26title%3DChris%2BSharma%2Band%2BMatt%2BSegal%2Bon%2Bthe%2BShaman%2Cview_count%3D2%252C037%26author%3DKrebsCOHO%26length_seconds%3D2569%26id%3DolWg5hYRv0o%26title%3DCompany%2Bof%2BHeroes%2B%252393%2B-%2BValiant%2BSacrifices%2Cview_count%3D255%252C178%26author%3DTheIllustrationArt%26length_seconds%3D180%26id%3DbN1_h_eGitE%26title%3DThe%2BTale%2Bof%2Bthe%2BThree%2BBrothers%2B%2528HD%2529%2Cview_count%3D4%252C312%26author%3DKrebsCOHO%26length_seconds%3D2418%26id%3DG1Isd6SM8aM%26title%3D%255BCOH%255D%2B%252374%2B-%2BLevel%2B20%2BWehrmacht%2Cview_count%3D7%252C734%26author%3DVorbeugungshaft%26length_seconds%3D292%26id%3DEO7NIzsBf44%26title%3DLeger%2Bdes%2BHeils%2B-%2BDer%2BGott%252C%2Bder%2BEisen%2Bwachsen%2Blie%25C3%259F%2Cview_count%3D153%252C325%26author%3DSarahFan0503%26length_seconds%3D338%26id%3DAnUVqu4CYus%26title%3DSarah%2BConnor%2B-%2B%2522Christmas%2BIn%2BMy%2BHeart%2522%2BLIVE%2B%2540%2BThe%2BChristmas%2BSpecial%2B2005%2Cview_count%3D23%252C660%26author%3DTriple6Games%26length_seconds%3D428%26id%3DEPUYh57VlH8%26title%3DTropico%2B4-PC%2BGameplay%2BHD%2BMaxed%2BOut&amp;vq=auto&amp;iv_enabled_features=TCS&amp;sendtmp=1&amp;ad3_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswfbin%2Fad3-vfly6I_ZM.swf&amp;gut_tag=%2F4061%2Fytunknown%2Fmain&amp;ptchn=KrebsCOHO&amp;as_launched_in_country=1&amp;length_seconds=2779&amp;feature=g-u&amp;enablejsapi=1&amp;plid=AAS2NjXP5DaZ4rS5&amp;iv_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswfbin%2Fiv_module-vflBrKDBK.swf&amp;afv=True&amp;ad_video_pub_id=ca-pub-6219811747049371&amp;ad_slots=0&amp;watermark=%2Chttp%3A%2F%2Fs.ytimg.com%2Fyt%2Fimg%2Fwatermark%2Fyoutube_watermark-vflHX6b6E.png%2Chttp%3A%2F%2Fs.ytimg.com%2Fyt%2Fimg%2Fwatermark%2Fyoutube_hd_watermark-vflAzLcD6.png&amp;supersizefeatured=1&amp;oid=oyMOP28xy70&amp;cc_module=http%3A%2F%2Fs.ytimg.com%2Fyt%2Fswfbin%2Fsubtitle_module-vfld45BNe.swf&amp;ad_channel_code_overlay=invideo_overlay_480x70_cat20%2Cafv_overlay%2CVertical_Overlay_8%2CVertical_Overlay_41%2CVertical_Overlay_933%2CVidVert8%2CVidVert41%2CVidVert933%2CVertical_8%2CVertical_41%2CVertical_933%2Cyt_mpvid_AAS2NjXQtb70zY15%2Cyt_cid_1640983%2Civp%2Cytexp_912208.914092.906423.901604%2Cytps_default%2Cytel_detailpage&amp;pyv_in_related_cafe_experiment_id=&amp;video_id=0LzC0V_6TfI&amp;sk=KGM0UWVabLqnTDH6CGaGWIPrk8jgepgiC" id="movie_player" src="http://s.ytimg.com/yt/swfbin/watch_as3-vfl7SkMGe.swf" type="application/x-shockwave-flash"> 

このビデオの自動再生を停止するにはどうすればよいですか?私はの後ろにsrcなどを追加して、運がないなど様々な方法を試しました。

誰も私が使っている方法の経験がありましたか?それは技術的に実行可能ですか? URL変数に以下を追加して

おかげ

+0

あなた 'flashvars'文字列は、私は私が今まで見てきたと思うのコードの単一の最も長いラインです! – Dallas

答えて

2

あなたが過剰に複雑なものです、あなたは少しでユーチューブ動画IDをつかむ必要があります正規表現:

if(preg_match('/(?<=video_id=).*?(?=&|")/',$str,$matches)){ 
    $video_id = $matches[0]; 
} 

次に、実際の埋め込みコードを作成するために使用します。

$youtube = '<iframe width="853" height="480" src="http://www.youtube.com/embed/'.$video_id.'?hd=1" frameborder="0" allowfullscreen></iframe>' 

そしてそれは決して自動再生

+0

実際、私は物事を複雑にしていると言います。私は現在、iFrames、オブジェクト、ビデオ、埋め込みを取得中です。あまり具体的ではなく、できるだけジェネリックにしたいと思っていましたが、これはチューブや多分他のビデオ店に行く方法のように思えます。ありがとう。 – HGPB

+0

アップデートを作成しました。 – HGPB

-1

試してみてください。

&自動再生= 0

+0

私は "http://s.ytimg.com/yt/swfbin/watch_as3-vfl7SkMGe.swf"のURLを埋め込んでいるのを見ましたが、youtubeや他のどこかからこのビデオを直接入手していますか? – Silvertiger

+0

スクレイプは生の埋め込みコードをYouTubeから引き出します。 – HGPB

関連する問題