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
    22,335
    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.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  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
    22,335
    What are you doing with $img_path after you assign a value to it?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  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
    22,335
    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?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.13769 seconds
  • Memory Usage 2,961KB
  • Queries Executed 15 (?)
More Information
Template Usage (35):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_html
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (10)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates