sulla
Junior Member

Posts: 69
|
Post by sulla on Mar 8, 2018 8:43:11 GMT
Thanks was just curios as I said. Have not looked at Drupal in a long time. Will have to see how its going now. As with most open source software the downside is in the documentation. There are gaps, big ones. Setup guides are often terrible taking the format of step 1 Install module, step 2 configure module. Which is infuriating. I've spent a lot of time contributing to the documentation, I've helped design and improve a few modules, and most importantly I've developed some server side software to make some of the headaches more managable. In the near future I am going to split the websites theme into an empty subtheme and expose it to changes on Drupal.org, so anyone will be able to contribute to the theme and i can then just install the updated version. More importantly it gives anyone with the skills to contribute a way to pitch in without me having to manage my own versioning and moderation system. Well sounds like you have it under control. 
|
|
John Becket
New Member
Sifting through the code
Posts: 30
|
Post by John Becket on Mar 8, 2018 11:46:43 GMT
Using the YouTube Data API, you could have a user authenticate over OAuth and request the users channel from the API, this could be a form of tallying the total channels that have banded together? Each channel is authed to verify that the channel owner has added it (not just a random person). Was planning something similar to this. You are welcome to jump in and help once we get onto the specifics. Whipped up some rough PHP that should do the trick, I've left out the authentication and database parts, for obvious reasons! Other than those two things, this might save you some time. Link to the API's explorer for reference - developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?part=snippet%252CcontentDetails%252Cstatistics&mine=true&_h=4&If a user is not authenticated, they cannot request their own YouTube channel, and so for testing purposes, the following code will work without authentication, by replacing in the $url string - mine=true, with id=a channel ID. For example: &id=UCeFqMpyL3g_adGBtDi8vKbQ I've looped the array as well, in-case for some reason you wish to return data from multiple channel ID's at once - For example: &id=UCeFqMpyL3g_adGBtDi8vKbQ,UCeFqMpyL3g_adGBtDi8vKbQ,UCeFqMpyL3g_adGBtDi8vKbQ etc <?php
/* A user will have to be already authenticated over OAuth, or else this script will return an error from the API
while using the mine filter. I've left the authentication and database parts out, as they would need to be set up
by you for obvious security reasons */
$apiKey = "YouTube Data API Key goes here";
/* Start a new session to manage the user data returned from the API */
$_SESSION['newChannel'] = array();
/* Fetch the authenticated user data from the API using the channels:list and mine filter */
$url = "https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&mine=true&key=$apiKey";
/* Sort returned data in an array */
$arr_list = channelsList($url);
foreach ($arr_list as $alist) {
foreach ($alist as $list) {
$newId = ($list->id);
/* Optionally strip the returned title of any special characters that may break code */
$newTitleRaw = ($list->snippet->title);
$newTitle = str_replace ("'", "", $newTitleRaw);
$newTitle = preg_replace ('/[^\p{L}\p{N}]/u', ' ', $newTitle);
$newTitle = preg_replace('/\s+/', ' ', $newTitle);
/* Optionally strip the returned description of any special characters that may break code */
$newDescriptionRaw = ($list->snippet->description);
$newDescription = str_replace ("'", "", $newDescriptionRaw);
$newDescription = preg_replace ('/[^\p{L}\p{N}]/u', ' ', $newDescription);
$newDescription = preg_replace('/\s+/', ' ', $newDescription);
/* Retrieve all the various channel information provided */
$newImage = ($list->snippet->thumbnails->medium->url);
$newStatViews = ($list->statistics->viewCount);
$newStatComments = ($list->statistics->commentCount);
$newStatSubscribers = ($list->statistics->subscriberCount);
$newStatVideos = ($list->statistics->videoCount);
/* Store the returned data in a database etc here - left out for your security */
echo "Channel ID: ";
echo $newId;
echo "<br />";
echo "Channel Title: ";
echo $newTitle;
echo "<br />";
echo "Channel Description: ";
echo $newDescription;
echo "<br />";
echo "Channel Image URL:";
echo $newImage;
echo "<br />";
echo "Channel Total Views: ";
echo $newStatViews;
echo "<br />";
echo "Channel Total Comments: ";
echo $newStatComments;
echo "<br />";
echo "Channel Total Subscribers: ";
echo $newStatSubscribers;
echo "<br />";
echo "Channel Total Videos: ";
echo $newStatVideos;
}
}
/* Function that decodes the returned JSON data from the API. */
function channelsList($api_url) {
$arr_result = json_decode(file_get_contents($api_url));
if (isset($arr_result->items) && !empty($arr_result->items)) {
$_SESSION['newChannel'][] = $arr_result->items;
}
return $_SESSION['newChannel'];
}
?>
|
|
|
Post by bigmonmulgrew on Mar 8, 2018 13:21:35 GMT
Was planning something similar to this. You are welcome to jump in and help once we get onto the specifics. Whipped up some rough PHP that should do the trick, I've left out the authentication and database parts, for obvious reasons! Other than those two things, this might save you some time. Link to the API's explorer for reference - developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?part=snippet%252CcontentDetails%252Cstatistics&mine=true&_h=4&If a user is not authenticated, they cannot request their own YouTube channel, and so for testing purposes, the following code will work without authentication, by replacing in the $url string - mine=true, with id=a channel ID. For example: &id=UCeFqMpyL3g_adGBtDi8vKbQ I've looped the array as well, in-case for some reason you wish to return data from multiple channel ID's at once - For example: &id=UCeFqMpyL3g_adGBtDi8vKbQ,UCeFqMpyL3g_adGBtDi8vKbQ,UCeFqMpyL3g_adGBtDi8vKbQ etc Thanks for that Tube frog. I have saved teh sample for later reference. I will look into this more once things are a bit more refined. I am a comaintainer of the Drupal Youtube Import module, although admittedly my involvement was largely only UI refinement and QA. I will discuss with the others if perhaps we should add the ability to import other Youtube data, or if we should launch a seperate module. Have you used Drupal, I could add you as a co-maintainer if we branch to a new module.
|
|
John Becket
New Member
Sifting through the code
Posts: 30
|
Post by John Becket on Mar 8, 2018 14:24:39 GMT
Whipped up some rough PHP that should do the trick, I've left out the authentication and database parts, for obvious reasons! Other than those two things, this might save you some time. Link to the API's explorer for reference - developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?part=snippet%252CcontentDetails%252Cstatistics&mine=true&_h=4&If a user is not authenticated, they cannot request their own YouTube channel, and so for testing purposes, the following code will work without authentication, by replacing in the $url string - mine=true, with id=a channel ID. For example: &id=UCeFqMpyL3g_adGBtDi8vKbQ I've looped the array as well, in-case for some reason you wish to return data from multiple channel ID's at once - For example: &id=UCeFqMpyL3g_adGBtDi8vKbQ,UCeFqMpyL3g_adGBtDi8vKbQ,UCeFqMpyL3g_adGBtDi8vKbQ etc Thanks for that Tube frog. I have saved teh sample for later reference. I will look into this more once things are a bit more refined. I am a comaintainer of the Drupal Youtube Import module, although admittedly my involvement was largely only UI refinement and QA. I will discuss with the others if perhaps we should add the ability to import other Youtube data, or if we should launch a seperate module. Have you used Drupal, I could add you as a co-maintainer if we branch to a new module. I've not touched Drupal in years to be honest, but I've been meaning to. Will have a play with it over the weekend and get back to you on that!
|
|
|
Post by bigmonmulgrew on Mar 13, 2018 23:34:57 GMT
Guys I have added 6 social logins, Please let me know what others you would like to see and i'll add them.
|
|
|
Post by bigmonmulgrew on Apr 16, 2018 9:22:23 GMT
Hi guys, I'll post here sfist for anyone whos been following the website development.
I have added the virtual membership cards to the website. You can see them here youtubebersunion.org/members-list
They can be setup on the profile page.
Planning to make them embeddable soon too.
|
|
|
Post by wonderwoman on Sept 6, 2019 23:58:45 GMT
I have subscribed to some email alerts but none of them come through with live/clickable links. Is there a setting I am not finding to enable the email alerts to come through as live links?
|
|