Chrome extension to get youtube video's URL
I don't know Javascript, but I will review the bash part.

First, replace if [ $count != 0 ]; then with if [ "$count" -ne 0 ]; then.  The double quotes are a best practice though not crucial in this case (more on that later).  The -ne is for arithmetic comparisons; != is for string comparisons.

The next bit which jumped out at me was:

if [ $filename != mergedList ]; then
    rm $filename
fi


Two things here: One, unless you have a very specific reason not to, you should always put $variablenames in double quotes.  Otherwise special characters can break your script.  (You did the same thing earlier in the script with YTBSTR and count, but those don't really matter because due to the way you assigned their value, you can determine that it is safe.  Still, it wouldn't hurt to double quote them.)  In this context the lack of double quotes is not safe.

(Actually I read somewhere that putting the static value first is safer, i.e. [ mergedlist != "$filename" ], but I don't know enough to be sure if that is true or to explain why.)

Two: This line compares a string $filename which was gotten from a file glob for *.txt, with a static string mergedList.  The two will never, ever match.  $filename will always end in .txt because of the way it is defined.  So you may as well remove that check entirely!

Next, you should single quote the output of echo.  In this case your echo commands will work, but for instance if you remove the space after the ! you will get an error.  Single quoting disables all special character interpretation.

There are definitely some other things here to fix—for instance there seem to be some assumptions made about the file mergedList that could cause weird errors or even security holes—but the above is a start.