php - Detect if a youtube channel exists anymore & don't display if it gives Error? -


so, after making new youtube page, noticed of current users have linked youtube channels via youtube api , our database, of users channels give error, no longer exist.

https://gyazo.com/d2ca429e408c9d843ee6e848ac8c4dda

so creating subscribe buttons code in echo in function.

<div class="g-ytsubscribe" data-channelid="'.$youtube_info['channel_id'].'" data-layout="full" data-count="default" data-onytevent="onytevent"></div> 

so can see, fetch data database , contacts youtube fetch channel info. of users channels no longer exist, wondered if there way detect this? , not display particular user being displayed @ all?

so query function.

    $query = "select user_id, yt_channeltitle, channel_id points channel_id !='' , yt_channeltitle != '' "; $query .="order channel_id desc limit " . ($objectsperpage*2) . " offset " . $_session['last_record']; 

i mean maybe thinking accross lines of type of maybe str_replace? method perhaps? question of detecting word error because gets displayed in youtube button instead of channel subscriber count , profile image, shows red icon error.?? open ideas :)

thanks

i wanted post answer question, , sorted workaround out issue.

i created section in our admin section can edit channel_id easily, , made blank. :)

https://gyazo.com/8c73c62ecceb61c2b6d1599a159bc819

so made function :) need click link , takes me channel. ease of access :)

i automatic method, if needed, sufficient now.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -