1

I am writing a program that automatically start up a web browser to a song of choice, so in order to do this my program is using an httwebrequest/response to

  • get the source code of a webpage that contains a link to the audio source page
  • search through that website source code and find the audio source website
  • open up chrome the the specified webpage, so i can listen to the song.

I am using project.com as my audio source, and I do not plan on using another site such as youtube

The problem I am having, is that, while I can see a link to the audio source website when i load the initial website in chrome, the page source does not contain it. For instance, this website which has a link to the audio source http://pl.st/s/1709472017 where you can actually see on the initial website, but when I look at the page source using chrome, then I cannot find this audio source link.

If I right click on the audio source textbox and select inspect element, then I can see this:

<input class="copy-song-link" 
   type="textbox" 
   value="http://pl.st/s/1709472017" 
   name="url" 
   onclick="javascript:select();" title="Copy and share this song URL">

so this link is clearly located somewhere. My questions are these

  • why/how is this link not in the source page, but i can see when i look at the website through chrome
  • how come chrome's "inspect element" can find this url, while the page source does not include it.

  • How does the inspect element differ from looking at the source code?

I am pretty new to http communication so any help would be appreciated.

4

1 に答える 1

2

私は通常、このような状況でFirefox用のプラグインFirebugを使用します。[ネット]タブを使用して、ページの読み込み中に発生する後続のすべてのリクエスト(多くの場合Ajax)を検査できます。

あなたの場合、Ajaxリクエストが、引き出したいリンクを生成するために使用されているデータを収集していたようです。このデータはJSONで表示され、JavaScriptはJSONからクライアント側でリンクを生成している可能性があります。このリンクを見て くださいhttp://www3.playlist.com/async/searchbeta/tracks?searchfor=r%20u%20mine

リンクの生成に使用されるlinkidは、応答の最初の部分にあります... PPL.search.trackdata = [{"linkid":1709472017 .. ..

于 2012-05-29T05:37:16.863 に答える