Author Topic: [HTML-PHP] Source code differs  (Read 4951 times)

0 Members and 2 Guests are viewing this topic.

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
[HTML-PHP] Source code differs
« on: September 07, 2012, 02:14:35 pm »

NOTICE: URL's are porn .

Hey,
I'm working on a php project right now (extracting videos) but got the following (weird) problem:

If you watch a video on pornhub,and 'Inspect Element' (FF) on the videoplayer you get:
Code: [Select]
<object style="visibility: visible;" id="playerDiv_1" data="http://cdn1.static.pornhub.phncdn.com/flash/player2012.swf?cache=2012090502" type="application/x-shockwave-flash" height="481" width="608">
<param value="true" name="allowfullscreen">
<param value="opaque" name="wmode">
<param value="always" name="allowscriptaccess">
<param value="pauseroll_url=http%3A%2F%2Fads.genericlink.com%2Fads%2Fsite%2Fpauseroll%2Fpornhub%2Fph_pauseroll.php&amp;autoplay=true&amp;autoreplay=false&amp;video_unavailable=&amp;link_url=http%3A%2F%2Fwww.pornhub.com%2Fview_video.php%3Fviewkey%3D9b7ba64f1023c182cb10&amp;image_url=http%3A%2F%2Fcdn2.image.pornhub.phncdn.com%2Fthumbs%2F000%2F104%2F957%2Fmain.jpg%3Fcache%3D4348973&amp;video_title=2+amazing%2C+tight+twins+get+rammed+by+2+cocks&amp;related_url=http%3A%2F%2Fwww.pornhub.com%2Fvideo%2Fplayer_related_datas%3Fid%3D104957&amp;video_url=http%3A%2F%2Fcdn1b.video.pornhub.phncdn.com%2Fvideos%2F000%2F104%2F957%2F104957.flv%3Frs%3D125%26ri%3D600%26s%3D1347009852%26e%3D1347011652%26h%3D79d5e6bd272298ba5938efb13a8cb3a2&amp;toprated_url=http%3A%2F%2Fwww.pornhub.com%2Fvideo%3Fo%3Dtr%26t%3Dm&amp;mostviewed_url=http%3A%2F%2Fwww.pornhub.com%2Fvideo%3Fo%3Dmv%26t%3Dm&amp;options=show&amp;postroll_url=http%3A%2F%2Fads.genericlink.com%2Fads%2Fsite%2Fpostroll%2Fpornhub%2Fph_postroll.php" name="flashvars">
</object>

But if you look at the sourcecode of the page,the upper code is replaced by:
Code: [Select]
<div id="playerDiv_1">
   <div class="no-flash-js">
         <div id="underplayer">
         <noscript>
         <div id="playerfail-nojs"><a href="http://www.macromedia.com/go/getflashplayer/"></a><>
         </noscript>
         <div id="playerfail"><a href="http://www.macromedia.com/go/getflashplayer/"></a><>
      <>
      <>
<>

What causes this?
And how do I get the upper code instead, when loading the code via file_get_contents,so I can extract the <object></object> part,for my project?
« Last Edit: September 10, 2012, 08:30:37 pm by Factionwars »
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline Stackprotector

  • Administrator
  • Titan
  • *
  • Posts: 2515
  • Cookies: 205
    • View Profile
Re: [HTML-PHP] Source code differs
« Reply #1 on: September 10, 2012, 07:13:59 pm »
It's because most browsers do not load jScript when looking at the source code. Tough the firebug like html inspectors show a live version of the html.

in short, the jScript on that page replaces the innerHTML of "playerDiv_1" with the vid. If you do not have jScript enabled it shows you the default html :)
~Factionwars

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [HTML-PHP] Source code differs
« Reply #2 on: September 10, 2012, 08:02:34 pm »
Ok,thx :)
But how do I also load the jScript part when loading the source code in PHP with get_file_contents ?
So I can extract the video and use it on my site...
Because right now I only get the <div> version instead of the <object> one...
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline Stackprotector

  • Administrator
  • Titan
  • *
  • Posts: 2515
  • Cookies: 205
    • View Profile
Re: [HTML-PHP] Source code differs
« Reply #3 on: September 10, 2012, 08:11:15 pm »
Ok,thx :)
But how do I also load the jScript part when loading the source code in PHP with get_file_contents ?
So I can extract the video and use it on my site...
Because right now I only get the <div> version instead of the <object> one...
You cannot,... you can.. but that will mean you have to execute their jScript and that is a major security weakness. Try finding out what their jScript does and where the video is retrieved.
~Factionwars

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [HTML-PHP] Source code differs
« Reply #4 on: September 10, 2012, 08:24:45 pm »
The Video source is "http://cdn1.static.pornhub.phncdn.com/flash/player2012.swf?cache=2012090502" in this case.
But to get the correct video out of the cache,I need the <object>-code,wich has the link,and the cache-data as an attribute...
And the last parameter also differs from vid to vid,so I need to get the last param too...

I can't do anything if I don't have the <object> code...

not sure about what the jScript does,but the swf is only their videoplayer.

And there isn't really a security-weakness,as the code also gets executed when someone watches a video on their website...
So one can trust this code I guess
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline Stackprotector

  • Administrator
  • Titan
  • *
  • Posts: 2515
  • Cookies: 205
    • View Profile
Re: [HTML-PHP] Source code differs
« Reply #5 on: September 10, 2012, 08:29:20 pm »
There is an embed function :

Code: (html) [Select]
<iframe src="http://www.pornhub.com/embed/0160c7345890467a4f9a" frameborder=0 height=481 width=608 scrolling=no name="ph_embed_video"><a href="http://www.pornhub.com/view_video.php?viewkey=0160c7345890467a4f9a">Bikini babe hard fuck for Jenaveve Jolie </a> brought to you by  <a href="http://www.pornhub.com/">PornHub</a></iframe><br><a href="http://www.pornhub.com/view_video.php?viewkey=0160c7345890467a4f9a">Bikini babe hard fuck for Jenaveve Jolie </a> brought to you by <a href="http://www.pornhub.com/">PornHub</a>
« Last Edit: September 10, 2012, 08:29:46 pm by Factionwars »
~Factionwars

Offline flowjob

  • Knight
  • **
  • Posts: 327
  • Cookies: 46
  • Pastafarian
    • View Profile
Re: [HTML-PHP] Source code differs
« Reply #6 on: September 11, 2012, 10:35:50 pm »
A already knew about the embed function,but I thought it loads the whole site + adds ect...
I didn't know the iframe shows a different site,just containing the video,as I didn't read the snippet that carefully.
thanks  ;D
Quote
<phil> I'm gonna DDOS the washing machine with clothes packets.
<deviant_sheep> dont use too much soap or youll cause a bubble overflow

Offline xzid

  • Knight
  • **
  • Posts: 329
  • Cookies: 41
    • View Profile
Re: [HTML-PHP] Source code differs
« Reply #7 on: September 12, 2012, 09:14:13 am »
oddly enough I have a script like this(don't judge me), where is all JS:

Code: (bash) [Select]
wget -qO- 'http://www.pornhub.com/view_video.php?viewkey=933596408' | grep video_url
var flashvars = {
// ...
"video_url":"http%3A%2F%2Fcdn1b.video.pornhub.phncdn.com%2Fvideos%2F004%2F040%2F867%2F4040867.flv%3Frs%3D125%26ri%3D600%26s%3D1347432961%26e%3D1347434761%26h%3D33d99ea79314ec5a811ec72e5aab59bc"

works good for me, URL decode, wget, EOF