Comments (4)
Came here from the comments posted on greasyfork. Hopefully I am posting in the right place (I've never posted on GitHub before) but this still seems to be a problem as of December 2021. At around 15/16 lines it cuts off from the rest of the lyrics that are there normally.
from konami-command.
Thank you for your report, @forrvalhalla.
It's the right place.
But I have to learn how my user script works again. I forgot how I coded this, years ago.
Hopefully, I will try within these 2 weeks.
from konami-command.
Ach, it seems it will be impossible to fix.
The full lyrics are provided by https://petitlyrics.com/com/get_lyrics.ajax
.
Then the content (a table of rows of text, URI encoded then Base 64 encoded).
Here is the decoder:
// https://www.base64decoder.io/javascript/#javascript-generic-base64-decode-with-support-for-16-bit-encoded-utf-16-strings
// Javascript Generic Base64 decode with support for 16-bit encoded (UTF-16) strings
function base64DecodeUnicodeToString(str) {
// Convert Base64 encoded bytes to percent-encoding, and then get the original string.
var percentEncodedStr = atob(str).split("").map(function(c) {
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
}).join("");
return decodeURIComponent(percentEncodedStr);
}
The request is made by https://petitlyrics.com/lyrics/*
page in POST
and Content-Type: application/x-www-form-urlencoded; charset=UTF-8
.
With no query parameters but the big problem is that it should be requested with an X-CSRF-Token
.
I don't know how to do that in user script. I don't think it is even possible, as the token has to be generated by server, I guess.
from konami-command.
Maybe I can retrieve that data[i].lyrics
and BTW I see that they do send a query parameter: lyrics_id
.
$(document).ready(function () {
eval("var a=\"sjn3hEe0VJLr-q_GZomfbBtIXyNgU4WxFuDHM8v5p2TS7AQdzi.C9lP1k6RcYaK+O@w\";var b=a.split(\"\").sort().join(\"\");var c=\"hrV2EEe3r77E00hrTe32Ve7Jh-3Ae2LJ\";var d=\"\";for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));var key = (\"\"+d+\"\");");
// Such a mysterious key!
$.post(
"/com/get_lyrics.ajax",
{
lyrics_id:1009898
},
function(data, textstatus, XMLHttpRequest){
var len = data.length;
for(var i=0; i<len; i++){
context.font = "12px sans-serif";
context.fillText(Base64.decode(data[i].lyrics), 0, (20*i)+20);
}
$(".ffrm").hide();$(".ffrm").show();
}
);
});
There are some stuff I still want to check.
from konami-command.
Related Issues (20)
- Remove big pics from non-release(-group) lists
- Recording: Appears on releases HOT 1
- Elephant Editor 'previous note' button HOT 2
- Remove old duplicate edit note
- Small pics are not shown in some release lists HOT 1
- Uncaught TypeError: Cannot read properties of null (reading 'querySelector') at 350:20 HOT 1
- Highlight excerpt release groups
- Does not handle artist credit HOT 1
- Allow loading releases from tags
- Handle MusicBrainz.eu
- Discogs Script Issues HOT 1
- Tampermonkey silently fails when no include or match HOT 1
- Can't add the same release to two different collections, if the collection highlighter is active
- A cover artist edit history link appears HOT 1
- Duplicate ISRCs not detected on duplicate recordings HOT 2
- remove style from script HOT 4
- EASY_DATE: Uncheck "This relationship has ended." when copy empty date
- show event art with FIR?
- Acoust ID not shown in MusicBrainz HOT 1
- Use MBS comment style
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from konami-command.