Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Paweł Wegner
libcloudstorage
Commits
a9f6f8e5
Commit
a9f6f8e5
authored
Jul 13, 2016
by
Paweł Wegner
Browse files
YouTube: added youtube_dl_url hint.
parent
5a335fce
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/CloudProvider/YouTube.cpp
View file @
a9f6f8e5
...
...
@@ -33,7 +33,24 @@ const std::string VIDEO_ID_PREFIX = "video###";
namespace
cloudstorage
{
YouTube
::
YouTube
()
:
CloudProvider
(
make_unique
<
Auth
>
())
{}
YouTube
::
YouTube
()
:
CloudProvider
(
make_unique
<
Auth
>
()),
youtube_dl_url_
(
"http://youtube-dl.appspot.com"
)
{}
void
YouTube
::
initialize
(
const
std
::
string
&
token
,
ICloudProvider
::
ICallback
::
Pointer
callback
,
const
ICloudProvider
::
Hints
&
hints
)
{
CloudProvider
::
initialize
(
token
,
std
::
move
(
callback
),
hints
);
setWithHint
(
hints
,
"youtube_dl_url"
,
[
this
](
std
::
string
url
)
{
youtube_dl_url_
=
url
;
});
}
ICloudProvider
::
Hints
YouTube
::
hints
()
const
{
Hints
result
=
{{
"youtube_dl_url"
,
youtube_dl_url_
}};
auto
t
=
CloudProvider
::
hints
();
result
.
insert
(
t
.
begin
(),
t
.
end
());
return
result
;
}
std
::
string
YouTube
::
name
()
const
{
return
"youtube"
;
}
...
...
@@ -152,10 +169,10 @@ IItem::Pointer YouTube::toItem(const Json::Value& v, std::string kind) const {
VIDEO_ID_PREFIX
+
video_id
,
IItem
::
FileType
::
Video
);
item
->
set_thumbnail_url
(
v
[
"snippet"
][
"thumbnails"
][
"default"
][
"url"
].
asString
());
item
->
set_url
(
"http://youtube-dl.appspot.com
/api/play?url=https://www.youtube.com/"
"watch?v="
+
video_id
);
item
->
set_url
(
youtube_dl_url_
+
"
/api/play?url=https://www.youtube.com/"
"watch?v="
+
video_id
);
return
item
;
}
}
...
...
src/CloudProvider/YouTube.h
View file @
a9f6f8e5
...
...
@@ -34,6 +34,9 @@ class YouTube : public CloudProvider {
public:
YouTube
();
void
initialize
(
const
std
::
string
&
token
,
ICallback
::
Pointer
,
const
Hints
&
hints
);
Hints
hints
()
const
;
std
::
string
name
()
const
;
private:
...
...
@@ -59,6 +62,8 @@ class YouTube : public CloudProvider {
public:
std
::
string
authorizeLibraryUrl
()
const
;
};
std
::
string
youtube_dl_url_
;
};
}
// namespace cloudstorage
...
...
Write
Preview
Supports
Markdown
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