Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
skylivex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
astronomy
skylivex
Commits
ddd01cc5
Commit
ddd01cc5
authored
Feb 28, 2013
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fake user agent on youtube requests on Mac OSX
parent
1bb40a03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
mainwin.cpp
src/mainwin.cpp
+25
-0
No files found.
src/mainwin.cpp
View file @
ddd01cc5
...
@@ -47,6 +47,27 @@
...
@@ -47,6 +47,27 @@
#define SENDER "maingui"
#define SENDER "maingui"
#if defined(Q_OS_MAC)
/*
* For some reason youtube think that the default user agent
* on OSX doesn't support HTML5 videos,
* so, we change it faking the Linux one
*/
class
QWebPageForMac
:
public
QWebPage
{
Q_OBJECT
public
:
QString
userAgentForUrl
(
const
QUrl
&
url
)
const
;
};
QString
QWebPageForMac
::
userAgentForUrl
(
const
QUrl
&
url
)
const
{
return
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) skylivex Safari/537.21"
;
}
#endif
MainWin
::
MainWin
(
QString
&
htmlfile
)
MainWin
::
MainWin
(
QString
&
htmlfile
)
:
SkylivexWin
(
htmlfile
)
:
SkylivexWin
(
htmlfile
)
{
{
...
@@ -145,7 +166,11 @@ void MainWin::handle_youtubevideo(SKMessage &msg)
...
@@ -145,7 +166,11 @@ void MainWin::handle_youtubevideo(SKMessage &msg)
{
{
yt
=
new
WebWin
();
yt
=
new
WebWin
();
yt_is_open
=
true
;
yt_is_open
=
true
;
#if defined(Q_OS_MAC)
QWebPageForMac
*
newWeb
=
new
QWebPageForMac
(
yt
);
#else
QWebPage
*
newWeb
=
new
QWebPage
(
yt
);
QWebPage
*
newWeb
=
new
QWebPage
(
yt
);
#endif
yt
->
setPage
(
newWeb
);
yt
->
setPage
(
newWeb
);
yt
->
setAttribute
(
Qt
::
WA_DeleteOnClose
,
true
);
yt
->
setAttribute
(
Qt
::
WA_DeleteOnClose
,
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment