RECENT TOPICS » View all
Does anyone know anything about source codes?
When using the Japanese website goo for lyrics, they block the right click and copy functions...
I guessed there must be a workaround in finding some link in the source code to get to the lyrics through another way.
So when looking at the source code I found that the text in question should be located around here:
<script type="text/javascript">
var cn;
function xcanvas(uu, canvasNodes) {
cn= canvasNodes;
var s = document.createElement('script');
s.setAttribute('src', '/sp/lyric/print_json.php?callback=draw&id=w2GQizqDofjNZGwzp9WjjdjXlIrzgN%2FaBgYHflggGDg%3D%3AFFoLLcbgXyhHvpHF%2BsYqK%2B5gb%2BtIwhS9wtcUf3ESBdE%3D');
document.getElementsByTagName('head')[0].appendChild(s);
}
function draw(data){
var y = 20;
document.getElementById('canvas').height = ( ( data.length + 1 ) * y );
var ctx = cn[0].getContext("2d");
ctx.textBaseline = "top";
ctx.font = '15px MS Pゴシック';
var i = 0;
for ( i = 0; i < data.length; i++ ){
ctx.fillText(data[i ], 0, y * i );
}
}
// IE9以上
var msie=navigator.appVersion.toLowerCase();
msie=(msie.indexOf('msie')>-1)?parseInt(msie.replace(/.*msie[ ]/,'').match(/^[0-9]+/)):0;
if(msie>8){
cn= getElementById('canvas');
var s = document.createElement('script');
s.setAttribute('src', '/sp/lyric/print_json.php?callback=draw&id=w2GQizqDofjNZGwzp9WjjdjXlIrzgN%2FaBgYHflggGDg%3D%3AFFoLLcbgXyhHvpHF%2BsYqK%2B5gb%2BtIwhS9wtcUf3ESBdE%3D');
document.getElementsByTagName('head')[0].appendChild(s);
}
</script>
And I tried doing a couple of things with this part of the link:
"/sp/lyric/print_json.php?callback=draw&id=w2GQizqDofjNZGwzp9WjjdjXlIrzgN%2FaBgYHflggGDg%3D%3AFFoLLcbgXyhHvpHF%2BsYqK%2B5gb%2BtIwhS9wtcUf3ESBdE%3D"
But I cannot find it. ^^
Can anyone help me? I want to learn about source codes! xD
Here is the webpage:
http://music.goo.ne.jp/lyric/LYRUTND42304/index.html
And the complete source code:
view-source:http://music.goo.ne.jp/lyric/LYRUTND42304/index.html
-Mesqueeb
Last edited by Mesqueeb (2012 January 05, 3:54 am)
For the record: I know there are workarounds like other websites or OCR the text.
But I just like to learn about source code. ^^
Free oline OCR that perfectly does Japanese:
http://www.sciweavers.org/free-online-ocr
Last edited by Mesqueeb (2012 January 05, 4:09 am)
<body oncontextmenu="return false" onselectstart="return false">
Is the line that is doing it.
In Chrome, open the developer tools and refresh the page. In the network section find the print_json.php file. You'll see the response is just to draw the UTF characters like so:
draw(["\u7d04\u675f\u3082\u3057\u306a\u3044\u306e\u306b \u6c7a\u307e\u3063\u3066\u305f\u624b\u3068\u624b"
But it also gives a preview ![]()
0: "約束もしないのに 決まってた手と手"
1: "↵きっと今から落ちてしまう"
2: "↵熱くなった チョコレート ひどく甘い匂い"
... etc
30: "↵二人占めしていたいから"
31: "↵夢にまで見た夢に 手が届きそう"
That's pretty hardcore for right click blocking, lol.
You get a response with unicode characters:
draw(["\u7d04\u675f\u3082\u3057\u306a\u3044\u306e\u306b \u6c7a\u307e\u3063\u3066\u305f\u624b\u3068\u624b" (...)
Translated with an online converter:
\u7d04\u675f\u3082\u3057\u306a\u3044\u306e\u306b => 約束もしないのに
Etc.
In Google Chrome or Safari you can use the javascript console (Ctrl Shift J), Network tab, "print_json.php" entry, Response tab, to see the JSON response. Or use Firebug in Firefox.
EDIT: Ah, travis beat me to it ![]()
And here's a Greasemonkey script to make the lyrics selectable:
http://isoron.org/stuff/goo_lyrics.user.js
Cool! Fast response and I learned a lot!
Now let me try and retrace the logic behind this.
A)
The reason to search for the "print_json.php" file is:
My guess: Because that's what it linked to when I found out that the link said:
"/sp/lyric/print_json.php?callback=draw&id=w2GQizqDofjNZGw..."
Or is the "print_json.php" something standard that is always looked for when messing with unclickable things?
B)
The reason to press the "network" tab:
I have no clue xD
C)
The reason to look at response and not at preview:
I guess that preview has limits, but in this case, since it's a small text, it all fits in there.
How's my guessing? xD
-Mesqueeb
Here are your lyrics:
約束もしないのに 決まってた手と手
きっと今から落ちてしまう
熱くなったチョコレート ひどく甘い匂い
わたしはすでに落ちている ゆるりゆるり融けながら
地下鉄は 生温い風
唇たたく 髪の毛の音
寄り添いたいな 鼻歌口ずさむその肩に
二人ぼっちに 慣れようか
朝昼夜 その先でもいいから
二人言で しゃべろうか
振り返る訳 触れずにはいられない
二人よがりに なりたいな
当たりくじだけのくじ引きがしたい
二人占めしていたいから
夢にまで見た夢に手が届きそう
快速の終着は 知らない街と人
きっと今から落ちてしまう 運命に気づいている
夕暮れは 二人の影を 熱く赤く 染めてくわ
憧れてるの どこにでも行けそうなその足のサイズ
二人...二人ぼっちに 慣れようか
逆算はできなくてもいいから
二人ぼっちは 好きですか?
リズムがあう それだけで恋しいんだ
二人よがりに なりたいな
当たりくじだけのくじ引きがしたい
二人占めしていたいから
夢にまで見た夢に手が届きそう
But I would have a question as well. What are you going to do with these lyrics? I would love to explore possibilities to study Japanese by means of lyrics/songs but for some reason most people don't seem to value that approach. And as for myself, I'm not advanced enough to handle more complex sentences yet.
When I was just starting out in Japanese, I translated all my favorite songs and listened to them a lot. I do think that it helped my listening comprehension and my vocabulary to some extent. The problem is that there are lots of songs that have wonky grammar and more complex sentences, and it's sometimes hard to tell where one sentence ends and another begins.
Mesqueeb wrote:
Cool! Fast response and I learned a lot!
Now let me try and retrace the logic behind this.
A)
The reason to search for the "print_json.php" file is:
My guess: Because that's what it linked to when I found out that the link said:
"/sp/lyric/print_json.php?callback=draw&id=w2GQizqDofjNZGw..."
Or is the "print_json.php" something standard that is always looked for when messing with unclickable things?
B)
The reason to press the "network" tab:
I have no clue xD
C)
The reason to look at response and not at preview:
I guess that preview has limits, but in this case, since it's a small text, it all fits in there.
How's my guessing? xD
-Mesqueeb
You solved most of it in your first post, just not how to see the response. Then print_json is a Javascript callback, so after the HTML page loads, the page calls print_json and writes the results to a 2D canvas. The network tab just logs all the network activity, so everything including images etc will be there. The response is the actual raw response, the preview is a just a preview, but sometimes it pretty prints it and that's useful for JSON data.
travis wrote:
Mesqueeb wrote:
Cool! Fast response and I learned a lot!
Now let me try and retrace the logic behind this.
。。。
-MesqueebYou solved most of it in your first post, just not how to see the response. Then print_json is a Javascript callback, so after the HTML page loads, the page calls print_json and writes the results to a 2D canvas. The network tab just logs all the network activity, so everything including images etc will be there. The response is the actual raw response, the preview is a just a preview, but sometimes it pretty prints it and that's useful for JSON data.
Cool thanks! I learned a lot! Seems also handy to rip images from websites that are locked. ^^
-Mesqueeb
Inny Jan wrote:
But I would have a question as well. What are you going to do with these lyrics? I would love to explore possibilities to study Japanese by means of lyrics/songs but for some reason most people don't seem to value that approach. And as for myself, I'm not advanced enough to handle more complex sentences yet.
Try it out, see how it works, and report back here so we can learn from your experience. ^^
I have never tried it, I only learned from manga, and subs2srs and living in Japan and so on.
iSoron wrote:
And here's a Greasemonkey script to make the lyrics selectable:
http://isoron.org/stuff/goo_lyrics.user.js
I tried and installing it, but it doesn't seem to work... >< Does it work in chrome? Because I only have chrome. ^^
It would be super handig though!
I have a new question!
To study some dutch proverbs I want to copy paste some entries from this website:
http://www.spreekwoord.nl/
Only when looking at this websites source code it seems impossible! The url doesn't change when looking things up, though I don't think it's java script... Or is it? xD
And when looking at a page's source it said in dutch: "Be Careful! You want to copy paste stuff? That is copyright violation and can be trailed!"
xD
Can someone help me get to the bottom of this? If I can find what I need I can look if I can study a similar greasemonkey script and make this site available for me as a resource to copy paste dutch proverb meanings. ^^
Fabrisu, do you speak Dutch or French? xD I guess you're from brussels? I'm from Antwerp actually.
-Mesqueeb
Mesqueeb wrote:
I have a new question!
To study some dutch proverbs I want to copy paste some entries from this website:
http://www.spreekwoord.nl/
Only when looking at this websites source code it seems impossible! The url doesn't change when looking things up, though I don't think it's java script... Or is it? xD
And when looking at a page's source it said in dutch: "Be Careful! You want to copy paste stuff? That is copyright violation and can be trailed!"
xD
Can someone help me get to the bottom of this? If I can find what I need I can look if I can study a similar greasemonkey script and make this site available for me as a resource to copy paste dutch proverb meanings. ^^
Fabrisu, do you speak Dutch or French? xD I guess you're from brussels? I'm from Antwerp actually.
-Mesqueeb
I turned Javascript off, and then selecting things worked. Hope that helps!
Last edited by Bokusenou (2012 January 05, 12:56 pm)
Mesqueeb wrote:
Try it out, see how it works, and report back here so we can learn from your experience. ^^
I did try, checkout this thread: Japanese songs for educational purposes.
Can you translate those two lines by FLiP from the first post? (I took me two weeks and talking to 3 people, two of them being Japanese, two get it translated).
Bokusenou wrote:
Mesqueeb wrote:
I have a new question!
To study some dutch proverbs I want to copy paste some entries from this website:
http://www.spreekwoord.nl/I turned Javascript off, and then selecting things worked. Hope that helps!
When I blocked Java script on that website in Chrome settings, and I refreshed, I got a dutch warning saying I need java script to be able to view the website. ![]()
Last edited by Mesqueeb (2012 January 06, 10:23 am)

