-
-
Notifications
You must be signed in to change notification settings - Fork 20
Support for new tv4play #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tack så mycket för hjälpen! :)
Det är några saker som måste ändras men jag kan göra det själv om det går bra. Har skrivit några kommentarer med förklaringar.
extension/js/tv4.js
Outdated
var filter = { domain: "www.tv4play.se", name: "tv4-refresh-token" }; | ||
chrome.cookies.getAll(filter, function (cookies) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Istället för att hämta cookien med chrome.cookies
så kan vi använda chrome.tabs.executeScript
. Då slipper vi be om nya behörigheter.
chrome.tabs.executeScript({
code: `document.cookie.split(';').map(c => c.trim()).find(c => c.startsWith("tv4-refresh-token="))?.split("=")[1]`
}, function(refreshToken) {
console.log('refreshToken', refreshToken);
});
extension/js/tv4.js
Outdated
// https://www.tv4.se/klipp/va/3349622/namen-har-sover-peter-dalle-under-tommy-korbergs-framtradande | ||
// https://www.tv4play.se/video/35e58882dbdd430da786/cornelia-jakobs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Det verkar som att gamla URL på tv4.se fortfarande fungerar, som den här till exempel. Så jag kommer nog bevara den gamla koden också så att de fortsätter att fungera.
Det verkar som att nya tv4.se program är lite krångligare. Exempel: https://www.tv4.se/artikel/4oYvgW4JjW7euNnluO7peA/bloet-start-pa-juli-sa-laenge-fortsaetter-regnet-kraftiga-askskurar
Här måste vi hitta en video id (20622424), som kan hittas i några olika ställen, t.ex. i __NEXT_DATA__
(görs redan i ur.js
). Tror att jag skippar detta tills senare.
extension/manifest.json
Outdated
"cookies", | ||
"https://www.tv4play.se" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Om vi hade behövt dessa så skulle vi stoppa dem i optional_permissions
och sedan be användaren att acceptera dem när de försöker använda tillägget på TV4. Detta är enkelt, exempel:
privatkopiera/extension/js/nrk.js
Lines 65 to 67 in 7d1c8c1
permissions: { | |
origins: ["https://psapi.nrk.no/"], | |
}, |
…ie and keep the old code around for old tv4.se URLs.
Fixes #172
New cookies permission is required for www.tv4play.se in order to extract the tv4-refresh-token key.