/    Sign up×
Community /Pin to ProfileBookmark

Facebook debug not display youtube ID

i want your help guys! first of all sorry for my bad english knowladge!

so now about my problem!

i have my own CMS where i have some posts there and i want to parse if
i have image in post i parse first image and put it in the meta og:image, i did it no problem but i olso parse youtube links, if i have some youtube iframe embed code there i want to parse this link and get youtube ID and then put this Id in this link http://img.youtube.com/vi/”HERE YOUTUBE id”/maxresdefault.jpg, to get youtube thumbnail for og:image.

so i did parser and i get youtube ID but problem is a ,when i
put it in the link in sourse code it is display normally but when i go in facebook Open Graph Object Debugger and check this link
debugger says that i have no ID in link

one important thing is that in my CMS i use

[code=php]ob_start();[/code]

function to display values in .tpl extension files, (i`m replacing values to my own codes like this

[code=php]$value = [value][/code]

)

here is my codes maybe help you understand this situation!

it is in source code

[code=html]<meta property=”og:image” content=”http://img.youtube.com/vi/kjI70L/maxresdefault.jpg” />
<meta property=”vk:image” content=”http://img.youtube.com/vi/kjI70L/maxresdefault.jpg” /> [/code]

it is facebook debug what say

[code=html]Meta Tag <meta property=”og:image” content=”http://img.youtube.com/vi/HERE MUST BE YOUTUBE ID BUT NOT SHOWING/maxresdefault.jpg” />
Meta Tag <meta property=”vk:image” content=”http://img.youtube.com/vi/HERE MUST BE YOUTUBE ID BUT NOT SHOWING/maxresdefault.jpg” /> [/code]

this is my small part of code where i put variable in thumbnail url:

[code=php]preg_match(‘/d/(w+)/’,$tubeurl,$img); //PARSE YOUTUBE LINK AND GET ALL IFRAME EMBED YOUTUBE ID
$youtube_id = $img[1]; //GET FIRST YOUTUBE ID
$img_path = “http://img.youtube.com/vi/”.$youtube_id.”/maxresdefault.jpg”; // PUT VARIABLE IN CODE [/code]

is any idea about this problem ? i have worked around this about 11 hour without rest but can`t make it work! so i really want your help .

P.S if something i wrote wrong here please ask me i will explain it !

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 23.2014 — This regexp looks questionable to me:
[code=php]'/d/(w+)/'[/code]
It says that you are searching for the letter "d" followed by a "/" and then capturing one or more consecutive "word characters" in a sub-pattern. Is that really what you want?

Maybe add some debug code to see what you are actually getting:
[code=php]
preg_match('/d/(w+)/', $tubeurl, $img); //PARSE YOUTUBE LINK AND GET ALL IFRAME EMBED YOUTUBE ID
error_log("DEBUG:".PHP_EOL.var_export($img, 1));
$youtube_id = $img[1]; //GET FIRST YOUTUBE ID
$img_path = "http://img.youtube.com/vi/".$youtube_id."
[/code]
Copy linkTweet thisAlerts:
@picburgauthorJun 23.2014 — <iframe style="display: block; margin-left: auto; margin-right: auto;" src="http://www.youtube.com/embed/FaD1PasRVJU" frameborder="0" width="560" height="315"></iframe>

i get youtube id from this iframe code, this regex get after embe[B]d[/B] until [B]"[/B]

it is what i want , if it doest working how i get in source code a valid youtube ID? i think it is working but problem is that Facebook debug can not see any variable what i put in thumb url, no GET parameter and nothing , fb display only this what i am writing with to my hand, i mean if i wrote something and not $variable fb can see but if i wrote there for example $_GET['id'] fb cant see
Copy linkTweet thisAlerts:
@picburgauthorJun 23.2014 — it`s my error log

array (

0 => 'd/FaD1PasRVJU',

1 => 'FaD1PasRVJU',

)
Copy linkTweet thisAlerts:
@picburgauthorJun 23.2014 — i think fb can not read $variable inside a link , like $id,$_get['id'] etc. if i write something in link fb see it but if i write with to help variable fb cant (( im getting crazy no idea how it!

maybe readon is buffer? i save everything in buffer and than put content , i mean ob_start()
Copy linkTweet thisAlerts:
@picburgauthorJun 23.2014 — no any ideas? (((
Copy linkTweet thisAlerts:
@NogDogJun 23.2014 — What are you doing with $img_path after you assign a value to it?
Copy linkTweet thisAlerts:
@picburgauthorJun 25.2014 — i put it like this $img_path = "http://img.youtube.com/vi/".$youtube_id."0.jpg"; to get thumbnail i put this link in meta og:image content
Copy linkTweet thisAlerts:
@NogDogJun 25.2014 — i put it like this $img_path = "http://img.youtube.com/vi/".$youtube_id."0.jpg"; to get thumbnail i put this link in meta og:image content[/QUOTE]

But where do you actually output $img_path? You showed where you defined it, but I was just wondering if there's any issue with how/where you actually use it after it's defined?
Copy linkTweet thisAlerts:
@picburgauthorJun 25.2014 — i put this in .tpl file in head of my site,

now i get strange thing ! when i write in index file something like echo "something"; facebook display all my content perfectly , that is it )))

my index struqture is like this

in index page i call class object

$object = new $object();

$object->page_render(here some variables);


and in page_reng function i preg_replace some literals like {HEAD},{SHORT_STORY} and etc.

my template file extensions is .tpl

eny idea? 3 days i am thinking about this , i can`t sleep normally ((( i realy what to do it
×

Success!

Help @picburg spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...