www.webdeveloper.com
Results 1 to 10 of 10

Thread: Facebook debug not display youtube ID

  1. #1
    Join Date
    Jun 2014
    Posts
    7

    Question 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
    PHP Code:
    ob_start(); 
    function to display values in .tpl extension files, (i`m replacing values to my own codes like this
    PHP Code:
    $value = [value
    )

    here is my codes maybe help you understand this situation!

    it is in source code

    HTML Code:
    <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" />

    it is facebook debug what say
    HTML Code:
    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" />

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

    PHP Code:
    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 

    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 !

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    This regexp looks questionable to me:
    PHP Code:
    '/d\/(\w+)/' 
    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:
    PHP Code:
    preg_match('/d\/(\w+)/'$tubeurl$img); //PARSE YOUTUBE LINK AND GET ALL IFRAME EMBED  YOUTUBE ID
    error_log("DEBUG:".PHP_EOL.var_export($img1));
    $youtube_id $img[1]; //GET FIRST YOUTUBE ID
    $img_path "http://img.youtube.com/vi/".$youtube_id.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jun 2014
    Posts
    7
    <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 embed until "
    it is what i want , if it does`t 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 can`t see

  4. #4
    Join Date
    Jun 2014
    Posts
    7
    it`s my error log

    array (
    0 => 'd/FaD1PasRVJU',
    1 => 'FaD1PasRVJU',
    )

  5. #5
    Join Date
    Jun 2014
    Posts
    7
    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 can`t (( i`m getting crazy no idea how it!

    maybe readon is buffer? i save everything in buffer and than put content , i mean ob_start()

  6. #6
    Join Date
    Jun 2014
    Posts
    7
    no any ideas? (((

  7. #7
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    What are you doing with $img_path after you assign a value to it?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  8. #8
    Join Date
    Jun 2014
    Posts
    7
    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

  9. #9
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Quote Originally Posted by picburg View Post
    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
    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?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  10. #10
    Join Date
    Jun 2014
    Posts
    7
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles