From List Wiki
Jump to: navigation, search

Paste this script into, and then run the code to get the cc or transcript from youtube to be used in List.Wiki.

Step by step on how to use this script:

  1. Copy the code provided below and paste into
  2. Copy the transcript found in any youtube video and paste into a blank note. Put the corresponding comma, full stop, question mark and punctuations into the raw youtube transcript pasted on the note while watching and listening to the video. Just inserting the punctuations without any modifications will do.
  3. After inserting all the punctuations, copy the transcript and paste into the $contents, which can be found in the php script you have pasted in the first step. Click run on the phpfiddle.
  4. Copy and paste the text generated on the phpfiddle into the transcript table section in any 'Videos:AAAA' page. Remember to open and close the table with {| and |} when inserting the code into the table row.

$contents = "
so, you want to start using the exciting
new block chain services on the ethereum
network. blah blah.

//Insert extra timestap after full stop.
$contents = preg_replace("@^([0-9]+\:[0-9]+)(\n)(.*)(\.|\?)( |$)@Um","$1$2$3$4 $1 ",$contents);
$contents = preg_replace("@^([0-9]+\:[0-9]+)(\n)(.*)(\.|\?)( )(.*)(\.|\?)( |$)@Um","$1$2$3$4$5$6$7 $1 ",$contents);

//Convert orignal timestap into a space.
$contents = preg_replace("@\n[0-9]+\:[0-9]+\n@U"," ",$contents);

//line break and list after full stop.
$contents = preg_replace("@([\.\?]) @U","$1<br/>*",$contents);

//for the first line first character.
$contents = "*00:00 ".trim($contents);

//Uppercase after full stop.
$contents = preg_replace_callback("@\*[0-9]+\:[0-9]+( )*[a-z]@U",function($matches){return strtoupper($matches[0]);},$contents);

//replace list* with {{cctd 
$contents = preg_replace("@(\*)([0-9]+\:[0-9]+) (.*)(\.|\?)(<br/>)@U","|-<br />| $2 || $3$4$5",$contents);

echo $contents;