Compare commits
No commits in common. "bc8a603d4e2c59933a83a5a373d58bc6ad7f8c5b" and "7fa1d0edb392a1ef9c7d258da5c076f53a1d4b2f" have entirely different histories.
bc8a603d4e
...
7fa1d0edb3
@ -197,32 +197,31 @@ export default Vue.extend({
|
|||||||
|
|
||||||
GetChannelFromYT(Channel: string) : void {
|
GetChannelFromYT(Channel: string) : void {
|
||||||
// Say it failed first so if we exit early then correctly marked fail.
|
// Say it failed first so if we exit early then correctly marked fail.
|
||||||
this.Title = "";
|
|
||||||
this.Description = "";
|
|
||||||
this.ID = "";
|
|
||||||
this.Thumbnail = "";
|
|
||||||
this.Valid = false;
|
this.Valid = false;
|
||||||
|
|
||||||
// Remove possible channel inputs.
|
// Copy over to internal ID box.
|
||||||
// https://www.youtube.com/channel/UC2DjFE7Xf11URZqWBigcVOQ
|
this.ID = Channel;
|
||||||
// UC2DjFE7Xf11URZqWBigcVOQ
|
|
||||||
// https://www.youtube.com/user/EEVblog <-- Take first channel found
|
|
||||||
// EEVblog <-- Take first channel found
|
|
||||||
|
|
||||||
// Remove any potential youtube URL from the field.
|
// Remove any potential youtube URL from the field.
|
||||||
Channel = Channel.replace("https://www.youtube.com", "");
|
const ytchurl = "https://www.youtube.com/channel/";
|
||||||
Channel = Channel.replace("/channel/", "");
|
if (this.ID.startsWith(ytchurl))
|
||||||
Channel = Channel.replace("/user/", "");
|
this.ID = this.ID.replace(ytchurl, "");
|
||||||
|
|
||||||
|
// Check if what remains looks like a youtube channel ID.
|
||||||
|
if (this.ID.length != "UCyS4xQE6DK4_p3qXQwJQAyA".length){
|
||||||
|
this.Title = "";
|
||||||
|
this.Description = "";
|
||||||
|
this.ID = "";
|
||||||
|
this.Thumbnail = "";
|
||||||
|
this.Valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Get channel metadata.
|
// Get channel metadata.
|
||||||
const API = 'https://www.googleapis.com/youtube/v3/channels/?';
|
const API = 'https://www.googleapis.com/youtube/v3/channels?';
|
||||||
const API_Parts = 'part=snippet';
|
const API_Parts = 'part=snippet%2CcontentDetails%2Cstatistics';
|
||||||
const API_Key = '&key=AIzaSyCuIYkMc5SktlnXRXNaDf2ObX-fQvtWCnQ'
|
const API_Key = '&key=AIzaSyCuIYkMc5SktlnXRXNaDf2ObX-fQvtWCnQ'
|
||||||
const API_Search_Query =
|
const API_Search_ID = '&id=' + this.ID;
|
||||||
((Channel.length == "UCyS4xQE6DK4_p3qXQwJQAyA".length) ? "&id=" : "&forUsername=")
|
Axios.get(API + API_Parts + API_Search_ID + API_Key).then((resp) => {
|
||||||
+ Channel;
|
|
||||||
Axios.get(API + API_Parts + API_Search_Query + API_Key).then((resp) => {
|
|
||||||
this.ID = resp.data.items[0].id;
|
|
||||||
this.Description = _.truncate(resp.data.items[0].snippet.description, {length: 70});
|
this.Description = _.truncate(resp.data.items[0].snippet.description, {length: 70});
|
||||||
this.Title = resp.data.items[0].snippet.title;
|
this.Title = resp.data.items[0].snippet.title;
|
||||||
this.Thumbnail = resp.data.items[0].snippet.thumbnails.high.url;
|
this.Thumbnail = resp.data.items[0].snippet.thumbnails.high.url;
|
||||||
|
@ -55,17 +55,8 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
overlay: {
|
|
||||||
warnings: true,
|
|
||||||
errors: true
|
|
||||||
},
|
|
||||||
historyApiFallback: true,
|
historyApiFallback: true,
|
||||||
proxy: {
|
noInfo: true
|
||||||
"/api": {
|
|
||||||
target: "https://dumbyt.hak8or.com",
|
|
||||||
changeOrigin: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
performance: {
|
performance: {
|
||||||
hints: false
|
hints: false
|
||||||
|
Loading…
Reference in New Issue
Block a user